CentOS 7 run-level switchover
Commands that switch from the command-line level to the window level are unchanged: init 5 or StartX
Commands that switch from the window level to the command line level are unchanged: Init 3
The new version of the runlevel is defined under/lib/systemd/system:
[Email protected] ~]# Ls-ltr/lib/systemd/system/runlevel*.target
lrwxrwxrwx. 1 root root 16 September 20:58/lib/systemd/system/default.target-Graphical.target
lrwxrwxrwx. 1 root root 13 September 20:58/lib/systemd/system/runlevel1.target-Rescue.target
lrwxrwxrwx. 1 root root 15 September 20:58/lib/systemd/system/runlevel0.target-Poweroff.target
lrwxrwxrwx. 1 root root 17 September 20:58/lib/systemd/system/runlevel4.target-Multi-user.target
lrwxrwxrwx. 1 root root 17 September 20:58/lib/systemd/system/runlevel3.target-Multi-user.target
lrwxrwxrwx. 1 root root 17 September 20:58/lib/systemd/system/runlevel2.target-Multi-user.target
lrwxrwxrwx. 1 root root 16 September 20:58/lib/systemd/system/runlevel5.target-Graphical.target
lrwxrwxrwx. 1 root root 13 September 20:58/lib/systemd/system/runlevel6.target-Reboot.target
[Email protected] ~]# Ln-svf/lib/systemd/system/runlevel3.target/etc/systemd/system/default.target
Or
[Email protected] ~]# Ln-svf/lib/systemd/system/multi-user.target/etc/systemd/system/default.target
Or
[[Email protected] ~] #systemctl set-default multi-user.target
[Email protected] ~]# Ln-svf/lib/systemd/system/runlevel5.target/etc/systemd/system/default.target
Or
[Email protected] ~]# Ln-svf/lib/systemd/system/graphical.target/etc/systemd/system/default.target
Or
[[Email protected] ~] #systemctl set-default graphical.target
1. SYSTEMD uses a more free target replacement than the Sysvinit run level. The 3rd run level is replaced with Multi-user.target. The 5th run level is replaced with Graphical.target. Runlevel3.target and Runlevel5.target are symbolic links that point to Multi-user.target and Graphical.target, respectively.
You can use the following command to switch to run Level 3:
Systemctl isolate Multi-user.target or Systemctl isolate Runlevel3.target
Systemctl isolate Graphical.target or Systemctl isolate Runlevel5.target
2. How do I change the default runlevel?
SYSTEMD uses links to point to the default runlevel. Before creating a new link, you can delete the existing link by following the command: Rm/etc/systemd/system/default.target
Default startup Run Level 3:
Ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.target
Ln-sf/lib/systemd/system/graphical.target/etc/systemd/system/default.target
The old RunLevel command can still be used under SYSTEMD. You can continue to use it, although SYSTEMD replaces the previous system's runlevel with the ' target ' concept (multiple ' target ' can be activated simultaneously).
The equivalent SYSTEMD command is Systemctl list-units–type=target
You can set different runlevel for different needs:
If you set the command line level (init 3) Method:
To set the window level (init 5) Method:
-----------------------------Split Line-----------------------------
To modify the system operating level:
You can use the following command to switch to run Level 5:
Default startup Run Level 5:
SYSTEMD does not use/etc/inittab files.
-----------------------------Split Line-----------------------------
How do I see the current runlevel?
The old RunLevel command can still be used under SYSTEMD. You can continue to use it, although SYSTEMD replaces the previous system's runlevel with the ' target ' concept (multiple ' target ' can be activated simultaneously).
The equivalent SYSTEMD command is Systemctl list-units–type=target
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
CentOS 7 run-level switchover