檢查Ubuntu版本
打開Terminal,輸入cat /etc/lsb-release
得到如下信息:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
由此得知,我的Ubuntu是14.04版本
然後找到下面這個網站:
Ubuntu 鏡像使用幫助
在上圖的1處選擇自己的Ubuntu的版本號
然後再Terminal中輸入下面的命令進行備份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
備份完後在Terminal中輸入
sudo gedit /etc/apt/sources.list
然後將其中的內容替換爲上圖2處的內容
# 默認註釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消註釋
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse
# 預發佈軟件源,不建議啓用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse
然後Ctrl+S,保存。
關閉這個文件,再次打開Terminal,輸入sudo apt update
換源完成!