In versions earlier than centos 7, the system running level is defined through the/etc/inittab file:
[[email protected] ~]$ cat /etc/centos-release
CentOS release 6.4 (Final) [[email protected] ~]$ cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault: [[email protected] ~]$
In centos 7, the file is no longer used to define the system running level. The related running level settings are invalid:
[[email protected] etc]$ cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core) [[email protected] etc]$ cat /etc/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 /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
#
id:3:initdefault: #invalid [[email protected] etc]$
The running level of the new version is defined under/lib/systemd/system:
[[email protected] system] $ls - LTR/lib/systemd/system/runlevel *
13 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel1. The target - > rescue. The target
LRWXRWXRWX. 1 root root 15 July 30 and the/lib/systemd/system/runlevel0. The target - > poweroff. The target
17 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel2. The target - > multi - user. Target
17 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel3. The target - > multi - user. Target
17 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel4. The target - > multi - user. Target
16 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel5. The target - > graphical. The target
13 July 30 and LRWXRWXRWX. 1 root root/lib/systemd/system/runlevel6. The target - > reboot. Target
You can set different running levels for different needs:
For example, set the command line level method:
Ln-SF/lib/systemd/system/runlevel3.target/etc/systemd/system/default.tar get
Or
Ln-SF/lib/systemd/system/multi-user.target/etc/systemd/system/default.tar get
Or
Systemctl set-default multi-user.target
How to set the window level:
Ln-SF/lib/systemd/system/runlevel5.target/etc/systemd/system/default.tar get or Ln-SF/lib/systemd/system/graphical.tar get/etc/systemd/system/ default.tar get
Or
Systemctl set-default graphical.tar get