CentOS system has 7 runlevels(runlevel)
Run level 0: The system is in shutdown state. The system default run level cannot be set to 0, otherwise it cannot start normally
Running level 1: single-user working status, root authority, used for system maintenance, remote login is prohibited
Run level 2: Multi-user state (without NFS)
Running level 3: Complete multi-user state (with NFS), enter console command line mode after logging in
Run Level 4: System is not used, reserved
Run level 5: X11 console, enter the graphical GUI mode after logging in
Run level 6: The system shuts down and restarts normally. The default run level cannot be set to 6, otherwise it cannot start normally.
Modify run level
The target concept is used in Centos7 to define the run level, which is divided into level 3 and level 5. The meaning is as follows:
Level 3->multi-user.target text Level 5->graphical.target graphics
1) Check the current running level
# runlevel [root@chezhi chezhi]# runlevel N 3 [root@chezhi chezhi]
#If the current default running level of the system is the graphical GUI mode, the runlevel display result is: 5 3
2) Modify the default boot run level
Systemd uses links to point to the default run level, determined by the /etc/systemd/system/default.target file.
Switch to run level 3:
a. Delete first: mv /etc/systemd/system/default.target /etc/systemd/system/default.target_copy5 #Rename the file
b. Create a soft link file: ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
or
ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target
Alternatively, you can also use the systemctl command:
systemctl set-default graphical.target
systemctl isolate multi-user.target
Finally shut down normally and restart the system: init 6
Then the system will automatically enter the console command mode when it boots up. If you want to switch back to the default graphical GUI mode, execute the command:
#Delete the file first [root@chezhi system]# rm -rf /etc/systemd/system/default.target #Recreate the soft link file [root@chezhi system]# ln -sf /lib/systemd/system/ graphical.target /etc/systemd/system/default.target
The above is the detailed content of How to change the default run level setting in CentOS7 system?. For more information, please follow other related articles on the PHP Chinese website!