Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the default run level of CentOS7 system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to modify the default running level of the CentOS7 system, which is very detailed and has a certain reference value. Friends who are interested must finish it!

The CentOS system has 7 runlevels (runlevel)

Runlevel 0: the system is down. The default runlevel of the system cannot be set to 0, otherwise it cannot start normally.

Runlevel 1: single user working status, root permissions, for system maintenance, no remote login

Runlevel 2: multi-user status (no NFS)

Runlevel 3: full multi-user state (with NFS), enter console command line mode after login

Runlevel 4: system not in use, reserved

Run-level 5:X11 console, log in and enter graphical GUI mode

Runlevel 6: the system shuts down and restarts normally. The default runlevel cannot be set to 6, otherwise it cannot start normally.

Modify the run level

In Centos7, the concept of target is used to define the running level, which is divided into 3 levels and 5 levels. The meanings are as follows:

Level 3-> multi-user.target text level 5-> graphical.target graphics

1) View the currently running level

# runlevel [root@chezhi chezhi] # runlevel N 3 [root@chezhi chezhi] #

If the current default run level of the system is graphical GUI mode, the runlevel display result is: 5 3

2) modify the default running level of boot

Systemd uses links to point to the default run level, as determined in the / etc/systemd/system/default.target file.

Switch to runlevel 3:

a. Delete: mv / etc/systemd/system/default.target / etc/systemd/system/default.target_copy5 # just rename the file

b. Create a soft connection 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 use the systemctl command:

Systemctl set-default graphical.target

Systemctl isolate multi-user.target

Finally, shut down and restart the system normally: init 6

Then the system starts up and automatically enters the console command mode. If you want to switch back to the default graphic GUI mode, execute the command:

# first delete the file [root@chezhi system] # rm-rf / etc/systemd/system/default.target # re-create the soft connection file [root@chezhi system] # ln-sf / lib/systemd/system/graphical.target / etc/systemd/system/default.target above is all the contents of the article "how to modify the default runtime level of the CentOS7 system". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report