Centos series set boot command line mode to start

The six operating levels in centos are as follows :

  • 0: shutdown runleve0 ---  poweroff.target
  • 1: Single user runleve1 --- rescue.target
  • 2: Multi-user without network runleve2 --- multi-user.target
  • 3: Multi-user has a network runleve3 --- multi-user.target
  • 4: Keep runleve4 --- multi-user.target
  • 5: Graphical interface runleve5 --- graphical.target
  • 6: Shut down and restart runleve6 --- reboot.target

1. The version below centos 7

Modify the inittab file in the following way and set the default startup mode

vim /etc/inittab

id:5:initdefault: -------> id:3:initdefault:

2. Centos 7 (inclusive) and above

  • Set to the default command line mode to start
systemclt set-default multi-user.target  #或者
systemctl set-default runlevel3

#等同于
rm /etc/systemd/system/default.target && ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
  • Set to the default graphics mode to start
systemclt set-default graphical.target  #或者
systemctl set-default runlevel5

#等同于
rm /etc/systemd/system/default.target && ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

View the relationship between them:

3. Manually start a certain mode

init 3 #运行命令行模式

init 5 #运行图形界面

4. Install the graphical interface

yum groupinstall "GNOME Desktop" "Graphical Administration Tools" #centos 8以下版本
dnf groupinstall "GNOME Desktop" "Graphical Administration Tools" #centos 8版本

There are a lot of updates, downloads and installation packages, please wait patiently

 

Reference link: https://www.cnblogs.com/calfmark/p/13721004.html

 

Guess you like

Origin blog.csdn.net/l_liangkk/article/details/114950550