CHI TIẾT BÀI VIẾT

Systemd Target và Init command trên CentOS

16/12/2021 5:14:46 PM | Xem: lần

1. Linux Booting Process

Power ON/Restart

🡪 BIOS/System Start

🡪 MBR Loading

🡪 GRUB Boot Loader

🡪 Kernel (Linux OS)

🡪 INIT Process (Run Levels)

🡪 User Prompt (User Commands)


2. Systemd targets in CentOS

//List target (runlevel) on your system (liệt kê các target/runlevel trên CentOS 7)

[root@itstar-centos7 Desktop]# ls /lib/systemd/system/runlevel*target –l


Run Level (CentOS 6/RHEL 6): /etc/inittab

Target (CentOS 7/8 - RHEL 7/8): /etc/systemd/system/default.target

Run Level

(RHEL 6)

Target

(RHEL 7/8)

INIT Command

Mô tả

0

poweroff.target

init 0

Shut down system

1

rescue.target

init 1


Start in Single User Mode (for Troubleshooting/Administration Tasks)

2

multi-user.target

init 2

Multiuser Mode but without networking.

3

multi-user.target

init 3

Multiuser Mode with networking.

4

multi-user.target

init 4

Reserved/User-definable

5

graphical.target

init 5

With Graphical User Mode (GUI) as runlevel 3 + display manager.

6

reboot.target

init 6

Reboots the system

 

Kiểm tra runlevel hiện tại trên hệ thống

//Using systemctl (method 1)

[root@itstar-centos7 Desktop]# systemctl get-default

// Using ls command (method 2)

[root@itstar-centos7 Desktop]# ls -altr /etc/systemd/system/default.target

 

3. Sử dụng lệnh init hoặc telinit

[root@itstar-centos7 Desktop]# init 3

[root@itstar-centos7 Desktop]# init 5

[root@itstar-centos7 Desktop]# init 6

[root@itstar-centos7 Desktop]# init 0