day 23 系統(tǒng)服務(wù)

1.linux 系統(tǒng)啟動過程

1.內(nèi)核的引導(dǎo)。

2.運行 init。

3.系統(tǒng)初始化。

4.建立終端 。

5.用戶登錄系統(tǒng)

centos6啟動流程


image.png

centos7啟動流程

image.png

centos6 和centos7區(qū)別?


image.png

2.運行級別

1. 運動級別就是操作系統(tǒng)當前正在運行的功能級別

Centos6

0 關(guān)機

1 單用戶模式 (超級權(quán)限 必須面對實體硬件)

2 暫未使用

3 字符界面(黑框)

4 暫未使用

5 圖形界面

6 重啟

其實我們一直常用的就是 3 字符界面模式

0 6 關(guān)機 重啟

3 5 字符 圖形 ----->分類記憶

2 4 沒有使用

1 單用戶

2. 臨時性的操作

[root@oldboy ~]# runlevel #查看級別

N 3

N 表示上一次是什么級別

3. 當前系統(tǒng)正在運行的級別

[root@oldboy ~]# init 3 #切換到3級別上

4. 永久操作 /etc/inittab

如果想要這個操作一直生效的話,需要修改 /etc/inittab 里面的配置文件

1. 運動級別Centos7

0 關(guān)機

1 單用戶模式 (超級權(quán)限 必須面對實體硬件)

2 暫未使用

3 字符界面(黑框)

4 暫未使用

5 圖形界面

6 重啟

0 6 關(guān)機 重啟

3 5 字符 圖形

2 4 沒有使用

1 單用戶

1. 運動級別

image.png

multi-user.target: analogous to runlevel 3

graphical.target: analogous to runlevel 5

查看當前的運行級別

[root@oldboy ~]# systemctl get-default

multi-user.target

修改系統(tǒng)下次啟動時候的運行級別

[root@oldboy ~]# systemctl set-default multiuser.

target

2.systemd

systemctl start nginx #在當前啟動 nginx

systemctl stop nginx #在當前停止 nginx

systemctl restart nginx #當前重新啟動nginx

systemctl reload nginx #

systemclt status nginx #查看 nginx

systemctl enable nginx #下一次開機啟動nginx,于當前無關(guān)

systemctl disable nginx #下一次開機不啟動nginx,于當前無關(guān)

當我們使用 systemctl 啟動一個守護進程后,可通過 systemctl status查看此守護進程的狀態(tài)

image.png

[root@oldboy ~]# #關(guān)機

shutdown -h now

poweroff

halt

init 0

systemctl poweroff

[root@oldboy ~]# #重啟

reboot

shutdown -r now

init 6

systemctl reboot

3.單用戶模式 超級權(quán)限 必須面對實體硬件

能正常引導(dǎo)進入系統(tǒng)

1.配置文件錯誤導(dǎo)致無法啟動

2.忘記ROOT密碼 ( 快照 | 單用戶修改)

https://mp.weixin.qq.com/s/1f-zCq8j4gL3xiB3AV9K3A 忘記root密碼

4.救援模式 系統(tǒng)無法正常進入 比如沒有內(nèi)核 比如grub被修改 比如系

統(tǒng)崩潰

沒有內(nèi)核文件,只能使用救援模式進入

系統(tǒng)崩潰, 要保留重要的數(shù)據(jù)的時候,也可以插上存儲,通過救援模式進入

grub菜單出現(xiàn)問題, linux windows,也可以通過救援模式進入解決

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容