3.1. 2018-01-02-练习systemd¶
3.1.1. 练习1¶
1、为编译安装的httpd服务,实现service unit文件
2、破解centos7 口令
方法1:
在启动的时候添加内核参数rd.break
chmount -o remount,rw /sysroot ; chroot /sysroot
passwd ;
touch /.autorelabel
方法2:
启动的时候修改r为rw,添加内核参数init=/sysroot/bin/bash
chroot /sysroot
passwd
touch /.autorelabel
3、修改默认的启动内核为新编译内核
1. 查看新内核在/boot/grub2/gurb.cfg里面的menuententry。
2. 修改/etc/default/grub中GRUB_DEFAULT=1
3. grub2-mkconfig
4. 重启即可
4、启动时临时禁用SELinux
selinux=0
5、启动时进入emergency模式
systemd.unit=emergency.target
6、卸载编译安装的新内核
1. 删除/boot目录对应文件
2. 删除/lib/modules对应文件
3. grub2-mkconfig
4. 重启