更換Ubuntu國內鏡像源


更換Ubuntu國內鏡像源:

由於Ubuntu官方軟件倉庫服務器位於國外,導致我們國內訪問體驗非常糟糕,下載網速只有200-300k左右,令人淚目。

所以我們需要將系統默認下載地址配置為國內的鏡像源,以此提高用戶體驗。

准備工作:

備份源文件:

cp /etc/apt/sources.list /etc/apt/sources.list.bak

若要恢復文件則:

cp /etc/apt/sources.list.bak /etc/apt/sources.list

編輯源文件:

使用nano編輯器對源文件進行編輯(需要root權限):

nano /etc/apt/sources.list

(使用 # 將原來默認源地址注釋掉)

添加源:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 

##測試版源  
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  

#源碼
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
#測試版源  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  

#Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner  
deb http://extras.ubuntu.com/ubuntu/ xenial main

(此處使用阿里雲的源為例,Ubuntu版本為16.04)

注意:Ubuntu系統根據其版本不同,其系統代號也不同,例如16.04版本其代號為Xenial Xerus,而20.04版本其代號為Focal Fossa,故鏡像源參數也有所不同,若你想將上文中針對Ubuntu16.04版本的國內鏡像源用於20.04版本,則你需要將代碼中 'xenial' 替換為 'Focal' 。

執行更新命令(應用源):

 sudo apt-get update
 sudo apt-get upgrade 

附錄:

Ubuntu歷史版本:

版本號 代號 發行日期
20.04 LTS Focal Fossa 2020/4/23
18.04 LTS Bionic Beaver 2018/04/26
16.04 LTS Xenial Xerus 2016/04/21
14.04 LTS Trusty Tahr 2014/04/18


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM