1. 程式人生 > 實用技巧 >Ubuntu換源完整操作

Ubuntu換源完整操作

目錄

檢查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

換源完成!