# 安裝Ubuntu 20.04 * VMware Workstation 16 Player安裝Ubuntu 20.04 >https://blog.xuite.net/yh96301/blog/341981056-VMware+Workstation+16+Player%E5%AE%89%E8%A3%9DUbuntu+20.04%3E * Ubuntu Server 20.04.1 安裝和設定教學 >https://www.footmark.info/linux/ubuntu/ubuntu-server-install/ * Ubuntu Server 20.04.1 預設 UFW 防火牆 Firewall 設定規則詳解和教學 >https://www.footmark.info/linux/ubuntu/ubuntu-server-ufw/ * 輕鬆製作可開機的 USB 磁碟機 >https://rufus.ie/zh_TW/ ## 需留意的點是,Ubuntu常常預設<font color=red>不會</font>把所有VG的硬碟空間分配給LV,請自已手動調整 ![](https://i.imgur.com/xFUGzCN.png) --- ## 常用指令 --- * 將 Ubuntu 系統套件與版本更新到最新: ```bash= sudo apt-get update && sudo apt-get upgrade -y ``` * 系統時區 1. Ubuntu Server 預設使用 UTC 時區,通常都會設定為所在地區的時間。 2. 查看系統上目前的時間和時區: ```bash= timedatectl ``` 3. 列出所有可用時區: ```bash= timedatectl list-timezones ``` 4. 將時區設定為台灣的 Asia/Taipei: ```bash= timedatectl set-timezone Asia/Taipei ``` * 手動設定固定 IP 1. 先將預設產生的設定檔複製留存 ```bash= sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak ``` 2. 編輯網路設定檔,來手動設定網路管理模式、固定 IP、網路遮罩、預設閘道、DNS Server 等資訊 ```bash= sudo vim /etc/netplan/00-installer-config.yaml ``` 請留意: * 是address<font color=red>es</font> * 所有:後面都要空一格,才能繼續輸入值 ```bash= # This is the network config written by 'subiquity' network: renderer networkd # 網路管理模式使用 Network Manager,未設定預設使用 systemd-workd ethernets: enp0s3: # 網路裝置 dhcp4: false # false: 關閉 DHCP;true: 啟用 addresses: [61.216.xx.xx/24] # 固定 IP 與網路遮罩 gateway4: 61.216.xx.254 # 預設閘道 nameservers: addresses: [8.8.8.8, 168.95.1.1] # DNS Server version: 2 ``` 3. 測試新網路設定是否正確,若設定檔語法正確,就會套用新的網路設定,並讓管理者進行確認。<font color=red>如果在 120 秒內沒有 Enter 確認,就會自動恢復成未設定前原來的網路設定</font>,此功能可避免在遠端更改網路設定有誤時,將自己檔在伺服器外面 ```bash= sudo netplan try ``` 如果出現以下錯誤訊息 ```bash= An error occurred: 'NetplanApply' object has no attribute 'state' ``` 則是2021-10-28的bug report * netplan try is broken >https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1949104 >https://askubuntu.com/questions/1369646/ubuntu-21-10-netplan-object-has-no-attribute-state 請改用以下指令 ```bash= sudo netplan try --state /etc/netplan ``` 4. 也可直接套用新的網路設定檔 ```bash= sudo netplan apply ```