CentOS 7 之前的版本是通过 /etc/inittab 文件来定义系统运行级别:
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/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 set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
新版本的运行级别都定义在 /lib/systemd/system下:
修改方法为:
1.首先删除已经存在的符号链接
----------------------------------------------------------------------------------
rm /etc/systemd/system/default.target
----------------------------------------------------------------------------------
2.默认级别转换为3(文本模式)
----------------------------------------------------------------------------------
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
----------------------------------------------------------------------------------
或者默认级别转换为5(图形模式)
----------------------------------------------------------------------------------
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
----------------------------------------------------------------------------------
3.重启
----------------------------------------------------------------------------------
reboot
----------------------------------------------------------------------------------
修改方法为:
1.首先删除已经存在的符号链接
----------------------------------------------------------------------------------
rm /etc/systemd/system/default.target
----------------------------------------------------------------------------------
2.默认级别转换为3(文本模式)
----------------------------------------------------------------------------------
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
----------------------------------------------------------------------------------
或者默认级别转换为5(图形模式)
----------------------------------------------------------------------------------
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
----------------------------------------------------------------------------------
3.重启
----------------------------------------------------------------------------------
reboot
----------------------------------------------------------------------------------
Last login: Wed Mar 4 15:12:23 2015 from 192.168.128.1
[root@localhost ~]# vi /etc/inittab
[root@localhost ~]# vi /etc/inittab
[root@localhost ~]# ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target
[root@localhost ~]# vi /etc/inittab
[root@localhost ~]#