麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統(tǒng) > RedHat > 正文

RedHat 開機(jī)起動流程

2024-07-26 00:31:01
字體:
供稿:網(wǎng)友
# 版權(quán)宣告: 1999 Copyright OLS3 All rights reserved.

# 作者: OLS3 (臥龍小三)
# 本講義僅供臺南縣 87 學(xué)年度網(wǎng)路管理進(jìn)階研習(xí)班上課之用.
# 學(xué)員可保存一份自用, 供日後網(wǎng)管時參考備查.
# 作者保有一切形式的著作權(quán).
# 欲作其它用途者, 需經(jīng)作者授權(quán)同意.
# 未經(jīng)作者授權(quán)同意之前, 請勿轉(zhuǎn)載刊登.

RedHat 開機(jī)起動流程 :

1. LILO 取得控制權(quán).

PC 起動時, 會讀取開機(jī)磁碟第一條 cylinder 的第一個 sector(此即 MBR), 然後它會試著將讀取到的程式碼載入記憶體中并且予以執(zhí)行. 這些程式碼, 就是 LILO. 記不記得, 當(dāng)初我們安裝時, 曾選擇將 LILO 放入MBR 呢?!

2. 載入 kernel

Red Hat 的 kernel 放在 /boot 中, 通常檔名類似 vmlinuz-2.0.34-0.6, vmlinuz-2.2.5-15

3. kernel 執(zhí)行第一支程式 /sbin/init

init 會根據(jù) /etc/inittab 這個 initialization table 來決定不同的 run-level 應(yīng)該如何設(shè)定系統(tǒng).

Red Hat 的 run-level 有以下 7 層: (定義在 /etc/inittab 中)

0 --- halt : 關(guān)機(jī) level 
1 --- Single user mode : 單人模式, 如果你忘記 root 密碼, 這是補(bǔ)救的方式之一. 
2 --- Multiuser, without NFS : 多人使用模式, 但沒有 NFS 功能, 如果安裝時沒有使用網(wǎng)路功能, 那麼 level 3 是一樣的. 
3 --- Full multiuser mode : 這是預(yù)定的 run-level 
4 --- unused : 這個 run-level 目前尚未定義使用 
5 --- X11 : X Windows 使用的 level 
6 --- reboot : 重新開機(jī)時使用的 level 
linux 系統(tǒng)開機(jī)時, 最重要的觀念便是這個 run-level , run-level 可以說是 Linux 的系統(tǒng)狀態(tài)(system states of Linux), 根據(jù)不同的情況進(jìn)入不同的系統(tǒng)狀態(tài), 以執(zhí)行不同的初始化動作.

另外一點, Linux 雖然融合了 System V 及 BSD 的特色, 但在開機(jī)起動的部份, 比較接近 System V 的作法, 并且這種方式幾乎已成為 Linux 世界的一項標(biāo)準(zhǔn). 因為它具有容易使用, 功能強(qiáng)大以及富有彈性的特色. 

其目錄檔案結(jié)構(gòu)如下:

/etc/rc.d 中包含:

目錄 script 檔案 
/etc/rc.d/init.d 
/etc/rc.d/rc0.d 
/etc/rc.d/rc1.d 
/etc/rc.d/rc2.d 
/etc/rc.d/rc3.d 
/etc/rc.d/rc4.d 
/etc/rc.d/rc5.d 
/etc/rc.d/rc6.d 
 rc 
rc.local 
rc.sysinit 
 

rc0.d 便是 run-level 0 起動 script 存放的目錄, rc3.d 是 run-level 3, 其它依此類推

不過, rc0.d ~ rc6.d 中的 script 并不是各自獨立的, 其實它們都是 symbolic file, 連結(jié)到 /etc/rc.d/init.d 中的 script.

比如 rc3.d 目錄中的檔案列表如下:

total 0
lrwxrwxrwx  1 root  root  20 May 23 15:56 K15postgresql -> ../init.d/postgresql
lrwxrwxrwx  1 root  root  17 May 23 15:56 K20rusersd -> ../init.d/rusersd
lrwxrwxrwx  1 root  root  15 May 23 15:56 K20rwhod -> ../init.d/rwhod
lrwxrwxrwx  1 root  root  16 May 23 15:56 K55routed -> ../init.d/routed
lrwxrwxrwx  1 root  root  17 May 23 15:56 S01kerneld -> ../init.d/kerneld
lrwxrwxrwx  1 root  root  17 May 23 15:56 S10network -> ../init.d/network
lrwxrwxrwx  1 root  root  15 May 23 15:56 S15nfsfs -> ../init.d/nfsfs
lrwxrwxrwx  1 root  root  16 May 23 15:56 S20random -> ../init.d/random
lrwxrwxrwx  1 root  root  16 May 23 15:56 S30syslog -> ../init.d/syslog
lrwxrwxrwx  1 root  root  13 May 23 15:56 S40atd -> ../init.d/atd
lrwxrwxrwx  1 root  root  15 May 23 15:56 S40crond -> ../init.d/crond
lrwxrwxrwx  1 root  root  17 May 23 15:56 S40portmap -> ../init.d/portmap
lrwxrwxrwx  1 root  root  15 May 23 15:56 S40snmpd -> ../init.d/snmpd
lrwxrwxrwx  1 root  root  16 May 23 15:56 S45pcmcia -> ../init.d/pcmcia
lrwxrwxrwx  1 root  root  14 May 23 15:56 S50inet -> ../init.d/inet
lrwxrwxrwx  1 root  root  15 May 23 15:56 S55named -> ../init.d/named
lrwxrwxrwx  1 root  root  13 May 23 15:56 S60lpd -> ../init.d/lpd
lrwxrwxrwx  1 root  root  18 May 23 15:56 S75keytable -> ../init.d/keytable
lrwxrwxrwx  1 root  root  18 May 23 15:56 S80sendmail -> ../init.d/sendmail
lrwxrwxrwx  1 root  root  13 May 23 15:56 S85gpm -> ../init.d/gpm
lrwxrwxrwx  1 root  root  15 May 23 15:56 S85httpd -> ../init.d/httpd
lrwxrwxrwx  1 root  root  15 May 23 15:56 S85sound -> ../init.d/sound
lrwxrwxrwx  1 root  root  13 May 23 15:56 S91smb -> ../init.d/smb
lrwxrwxrwx  1 root  root  11 May 23 15:48 S99local -> ../rc.local

各位可以發(fā)現(xiàn): 這些 script 檔不是以 S 開頭, 就是以 K 開頭, 其後再接上二位數(shù)字, 并且皆連結(jié)到 init.d 目錄中的相關(guān) scripts 檔.

以 S 開頭的, 表示 Start 起動之意, 而 K 開頭的, 則是 Kill 殺除之意.

4. init 執(zhí)行第一支 script : /etc/rc.d/rc.sysinit

rc.sysinit 會設(shè)定許多系統(tǒng)變數(shù), 如:

設(shè)定 PATH 
設(shè)定網(wǎng)路: 讀取 /etc/sysconfig/network, 以設(shè)定 NETWORKING, FORWARD_IPV4, HOSTNAME, DOMAINNAME, GATEWARY, GATEWAYDEV(eth0) 
設(shè)定 NIS domain name 
并且執(zhí)行 run-level 啟動之前所需的許多準(zhǔn)備動作, 如:

起動 swapping 
checking root filesystems : 檢查 root 檔案系統(tǒng) 
檢查系統(tǒng)參數(shù) (/PRoc), 設(shè)定 PNP 
清除 /etc/mtab 
mount root 及 /proc 檔案系統(tǒng) 
決定是否使用模組, 載入模組 
檢查檔案系統(tǒng) (使用 fsck) 
掛上其它檔案系統(tǒng) 
設(shè)定 console 字型 
打開 quota 
清除不必要的檔案, 如 lock, pid 
設(shè)定 clock 
serial port 初始化 
將開機(jī)訊息經(jīng)由 dmesg 放入 /var/log/dmesg 中 
 

5. init 執(zhí)行預(yù)設(shè)的 run-level 目錄中所有的 scripts

正常情況下就是 rc3.d, 因為 /etc/inittab 中有一行設(shè)定是: id:3:initdefault: 表示預(yù)設(shè)要執(zhí)行的 run-level 是 level 3. 因此, 剛剛上面各位看到的 rc3.d 中的 Sxx 及 Kxx 都會被執(zhí)行.

6. 最後 init 執(zhí)行 /etc/rc.d/rc.local 這支 script.

rc.local 會在各 run-level 的 script 執(zhí)行完之後再執(zhí)行. 您可以將自己想在開機(jī)時處理的動作加在這個 script 之中.

7. init 執(zhí)行完之後, 接著執(zhí)行 /bin/login 程式

login 程式會提示使用者需輸入帳號及密碼, 接著編碼并確認(rèn)密碼的正確性, 若二者相合, 則為使用者進(jìn)行初始化環(huán)境, 并將控制權(quán)交給 shell.

8. shell 

假設(shè)預(yù)設(shè)的 shell 是 bash, 則 bash 會先尋找 /etc/profile, 執(zhí)行其中的指令, 然後搜尋使用者目錄中, 是否有 .bash_profile, .bash_login, 或 .profile, 執(zhí)行其中一個, 接著命令提示符號 $ 便出現(xiàn)在螢?zāi)簧? 等待您輸入命令.

至此, 完成了整個開機(jī)的流程.

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 久久久免费观看完整版 | 国产精品视频一区二区三区四区国 | 91一区二区三区久久久久国产乱 | 成人免费乱码大片a毛片视频网站 | 国产妇女乱码一区二区三区 | 成人性生活视频在线观看 | 美女性感毛片 | 中文字幕国 | 中国美女一级黄色大片 | 免费男女视频 | 国产精品爱久久久久久久 | 91精品国产一区二区三区动漫 | 天堂福利电影 | 一级电影免费在线观看 | 久久久久免费精品国产小说色大师 | 成人免费一区二区三区视频网站 | av在线播放免费 | 在线高清中文字幕 | 天天夜碰日日摸日日澡性色av | 成人三级黄色片 | 黄色网页在线看 | 国产一区二区三区色淫影院 | 91国在线高清视频 | 中文字幕偷拍 | 欧美毛片免费观看 | 一级在线免费 | 久久精品com| 欧美一级高潮 | av电影在线免费 | 亚洲精品成人久久 | 永久久久 | 护士hd欧美free性xxxx | 国产成人精品午夜 | 国产精品久久久久久久久久三级 | 免费一区区三区四区 | 热99视频 | 亚洲日本韩国精品 | 久久精品中文字幕一区二区三区 | 午夜啪视频 | 精品国产一区二区三 | 一级黄色欧美 |