set Ubuntu mirror
environment: Ubuntu 22.04 LTS on Windows
Step 1. 確認當前mirror的網址,例如: archive.ubuntu.com
cat /etc/apt/sources.list | grep main | awk '{ print $2 }' | cut -d'/' -f3 | sed -n '3P'
Step 2. 置換成想要的mirror網址,例如: free.nchc.org.tw
sudo sed -i 's/archive.ubuntu.com/free.nchc.org.tw/g' /etc/apt/sources.list
(可再用Step 1檢查是否置換成功)
Step 3. Update and Upgrade
sudo apt update
sudo apt upgrade