CentOS 8 伺服器作業系統安裝和設定
系統安裝
系統模式
使用 CentOS 8 安裝檔開機會有下述三種模式:
- Install CentOS Linux 8:正常安裝系統流程。
- Test this media & install CentOS Linux 8:測試媒體後在進入安裝系統流程。
- Troubleshooting:進入【除錯模式】,能夠救授 CentOS 系統和執行記憶體測試 (Run a memory test) ...。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/27abafbec370fc989b50852326a5efbe.png?resize=640%2C480&ssl=1)
選擇系統語言
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/2d0df368da0f1c10f8be0c51b32d4ab9.png?resize=800%2C600&ssl=1)
磁碟分割與檔案系統
/home、swap 和 / 這三個【掛載點】將來容量有可能會變動,因此【裝置類型】設定為可以彈性增加和減少檔案系統容量的 LVM。
掛載點 | 裝置類型 | 檔案系統 | 建議容量 |
---|---|---|---|
biosboot | 標準分割區 | BIOS Boot | 2MB |
/boot | 標準分割區 | ext4 | 1GB |
/home | LVM | xfs | 5GB 以上 |
swap | LVM | swap | 參考 Red Hat swap 建議 |
/ | LVM | xfs | 剩餘容量 |
點選【安裝目的地】,就是要將系統安裝到哪個磁碟。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f299d2f1dfc8a3c99c7cf308a3d16aab.png?resize=800%2C600&ssl=1)
- 勾選系統要安裝的磁碟。
- 點選【自訂】來自行手動分割。
- 點擊【完成】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/a47931abad48d0cde6166c7aacf296ea.png?resize=800%2C600&ssl=1)
點擊【+】加入新的掛載點。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/a112e7d91a7f9ee2f8498b471790afd5.png?resize=800%2C600&ssl=1)
依照下圖來新增其它所有掛載點。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/de92f844f382e8f23c8d89f436b39ec7.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/a4c7d55e040a400fdc90c97192aba34e.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/1f3f7e6c436a026d42c364556e70767b.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/18402647f3198f3c36cff995e8ebb288.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/ea88aa3ca76e794deb17f47cc776ad3d.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/07b6bcdbc0089b1acfeb370dc1e8f7d0.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/c05d555958f20f0444fb290b94d227ef.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/707e49bfe17e7e3ffe558ddd88802e60.png?resize=800%2C600&ssl=1)
【欲使用容量】未輸入時,則會將剩餘的【可用容量】全部分配給它。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/3b0ba777dba16864a28d385f4171fa81.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/2bc083636b12e3f60842c1fc2842c7ba.png?resize=800%2C600&ssl=1)
- 所有掛載點分割完後點擊【完成】。
- 點擊【接受變更】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/d6c457a2cb3c5eeb1b374d4cd1f9d442.png?resize=800%2C600&ssl=1)
軟件選擇
系統預設選擇安裝【含有 GUI 的伺服器】,也就是像 Windows 作業系統一樣有圖形使用者介面,但作為伺服器用途建議選擇【最小型安裝】的 CLI (命今列介面),它不會安裝額外的軟體,所有需要使用的軟體均需自行安裝,而且少了 GUI 效率更佳 。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/7833647b808f8fe5b618ebd34eb66319.png?resize=800%2C600&ssl=1)
- 點選【最小型安裝】。
- 點擊【完成】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/1a2d7f5252317df89b0bb238f8e4b58d.png?resize=800%2C600&ssl=1)
網路和主機名稱
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f87440e2195ef60be85378e2d0930d73.png?resize=800%2C600&ssl=1)
點擊【配置】進行網路設定。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/c856dad1c999f57d7e1c8cd730bffc53.png?resize=800%2C600&ssl=1)
作為伺服器用途通常都會指定固定 IP。
- 點擊【IPv4 設定】。
- 點擊【新增】並輸入固定 IP【地址】的相關配置。
- 設定【DNS servers】,可使用逗號 , 分隔輸入多組。
- HiNet:168.95.1.1。
- Google:8.8.8.8。
- 點擊【儲存】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/9f4a5019c4dfe4eb7f6234bff8763b36.png?resize=800%2C600&ssl=1)
- 點擊【一般】。
- 勾選【Connect automatically with priority】網路可用時自動連線。
- 點擊【儲存】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f6a44eb60ad80d995929be2c2459865f.png?resize=800%2C600&ssl=1)
點擊【完成】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/d9ae4a1bc560a27f630f423bb6e3484c.png?resize=800%2C600&ssl=1)
時間和日期
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/830c27994a03850112fef79e96445427.png?resize=800%2C600&ssl=1)
- 選取【區域】和【城市】。
- 啟用【網路時間】NTP (網路時間協定) 網路自動校時。
- 點擊【完成】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/13b69ad9cc2c03a97e8be44e46a9de1e.png?resize=800%2C600&ssl=1)
開始安裝
上述所有設定均確認無誤後,點擊【開始安裝】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/20a8242af24f3deca262a751b3ef173a.png?resize=800%2C600&ssl=1)
點擊【根密碼】來設定 root 的密碼。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/9eeccc7bd6e56bfb44f95f6959c53b2e.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f3b8bccdd5ebdbd86fce1377d7038d55.png?resize=800%2C600&ssl=1)
點擊【創建用戶】來建立使用者。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f51544da80b35a5d760f105262cb4fa6.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/bc50f422fe2ccae0d879dc44d7a00d10.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/65ac176e22ddbb1949bb484925c3e40b.png?resize=800%2C600&ssl=1)
安裝完成,點擊【重新開機】。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/072bca271a44719333d750cf1a7d0b2e.png?resize=800%2C600&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/ec44c2d44ffd9e08a29fc622bc298862.png?resize=720%2C400&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/f078fa3b36aaf9e8e9ef70c1c7c2b4a8.png?resize=800%2C600&ssl=1)
其它
安裝 Cockpit
Cockpit 是基於 Web 介面的應用程式,可用來管理伺服器並監視和調整系統資源。
如果 CentOS 8 是使用【最小型安裝】Cockpit 須手動安裝:
dnf install -y cockpit
設定 Cockpit 開機自動啟用 (enable) 且立即啟用 (--now):
systemctl enable --now cockpit.socket
firewall 預設已允許 cockpit (port 9090):
firewall-cmd --list-all
public (active) target: default icmp-block-inversion: no interfaces: enp0s3 sources: services: cockpit dhcpv6-client ssh ... 以下省略 ...
開啟瀏覽器輸入 IP:9090 即可連結到 Cockpit。
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/dd15948029da31bdf3fb8c8e92651e0b.png?resize=1024%2C442&ssl=1)
![](https://i0.wp.com/footmark.com.tw/wp-content/uploads/2020/02/ade0eb2e46b71e6d063945e50181c2b4.png?resize=1024%2C561&ssl=1)
![創用 CC 授權條款](https://i.creativecommons.org/l/by-sa/3.0/tw/88x31.png)
本著作係採用創用 CC 姓名標示-相同方式分享 3.0 台灣 授權條款授權.