CentOS7修改默认运行级别

新装了一个虚拟机,图形界面启动太慢,想调整一下按照以前的经验改运行级别,输入:

vi /etc/inittab

然后发现跟之前不一样了,在inittab设置不再生效:

# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
仔细读一下上面的提示
multi-user.target 类似与之前的runlevel 3
graphical.target 类似与之前的runlevel 5

按照上面的提示,查看当前的默认target输入命令:
[root@localhost ~]# systemctl get-default
graphical.target
[root@localhost ~]# 
当前为graphical.target

修改为命令模式multi-user.target:
[root@localhost ~]# systemctl set-default multi-user.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
[root@localhost ~]# 

查看一下当前,发现得到预期要求:

[root@localhost ~]# systemctl get-default
multi-user.target
[root@localhost ~]# 

 

最后重启发现,果然是命令模式~~

 

posted @ 2018-03-28 22:37  QiaoZhi  阅读(968)  评论(0编辑  收藏  举报