RHEL 6 和 RHEL 7 的一些區別
阿新 • • 發佈:2019-02-02
執行級別概念的區分
System V init 執行級別 | systemd 目標名稱 | 作用 |
---|---|---|
0 | runlevel0.target, poweroff.target |
關機 |
1 | runlevel1.target, rescue.target |
單使用者模式 |
2 | runlevel2.target, multi-user.target |
等同於級別 3 |
3 | runlevel3.target, multi-user.target |
多使用者的文字介面 |
4 | runlevel4.target, multi-user.target |
等同於級別 3 |
5 | runlevel5.target, graphical.target |
多使用者的圖形介面 |
6 | runlevel6.target, reboot.target |
重啟 |
emergency | emergency.target |
緊急 Shell |
systemctl 管理服務的啟動、重啟、停止、過載、檢視狀態等常用命令區分
System V init 命令(RHEL 6) | systemctl 命令(RHEL 7) | 作用 |
---|---|---|
service foo start |
systemctl start foo.service |
啟動服務 |
service foo restart |
systemctl restart foo.service |
重啟服務 |
service foo stop |
systemctl stop foo.service |
停止服務 |
service foo reload |
systemctl reload foo.service |
重新載入配置檔案(不終止服務) |
service foo status |
systemctl status foo.service |
檢視服務狀態 |
systemctl 設定服務開機啟動、不啟動、檢視各級別下服務啟動狀態等常用命令
System V init 命令(RHEL 6) | systemctl 命令(RHEL 7) | 作用 |
---|---|---|
chkconfig foo on |
systemctl enable foo.service |
開機自動啟動 |
chkconfig foo off |
systemctl disable foo.service |
開機不自動啟動 |
chkconfig foo |
systemctl is-enabled foo.service |
檢視特定服務是否為開機自動啟動 |
chkconfig --list |
systemctl list-unit-files --type=service |
檢視各個級別下服務的啟動與禁用情況 |