修改默认运行级别
systemctl set-default multi-user.target
可以用来将默认(开机启动后)运行级别设定为3
[root@docker ~]# ll /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 36 Feb 23 10:25 /etc/systemd/system/default.target -> /lib/systemd/system/graphical.target
[root@docker ~]# ll /lib/systemd/system/multi-user.target
-rw-r--r--. 1 root root 492 Nov 20 12:49 /lib/systemd/system/multi-user.target
[root@docker ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
[root@docker ~]# ll /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 41 Feb 23 13:46 /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target
[root@docker ~]#
[root@docker ~]# runlevel
N 5
[root@docker ~]#
切换当前的运行级别
代码语言:javascript复制[root@docker ~]# runlevel
N 5
[root@docker ~]# systemctl isolate multi-user.target
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
PolicyKit daemon reconnected to bus.
Attempting to re-register as an authentication agent.
We are now a registered authentication agent.
[root@docker ~]#
[root@docker ~]# runlevel
5 3
[root@docker ~]# systemctl get-default
multi-user.target
[root@docker ~]#
切换完当前运行级别后,图形界面会变成CLI界面
命令汇总
cat /etc/redhat-release
uname -a
egrep --color '(vmx|svm)' /proc/cpuinfo
yum grouplist
yum groupinfo Virtualization
yum groupinfo 'Virtualization Tools'
yum groupinfo 'Virtualization Client'
grep -v "^#" ifcfg-eth0
grep -v "^#" ifcfg-br0
/etc/init.d/network restart ; ifup br0
virt-manager
cat /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/init.d/network restart
cat /etc/inittab
ll /lib/systemd/system/runlevel3.target
ll /lib/systemd/system/runlevel5.target
ll /lib/systemd/system/multi-user.target
systemctl set-default multi-user.target
ll /etc/systemd/system/default.target
systemctl isolate multi-user.target
runlevel
systemctl get-default
原文地址