1. 程式人生 > >Ubuntu 各版本的幾個國內更新源

Ubuntu 各版本的幾個國內更新源

環境 pre build inux pac iyu plain 重新 dde

Ubuntu 國內更新源(各版本通用)

前言:為了下載更方便,速度更快,我們往往在使用Linux系列系統時修改apt源為國內的源

1.復制源文件備份,以防萬一

修改文件sources.list,在目錄/etc/apt/下,

sources.list是 包管理工具apt 所用的記錄軟件包倉庫位置的配置文件,同樣類型的還有位於 同目錄下sources.list.d文件下的各種.list後綴的各文件。

命令如下:

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

2.查看ubuntu版本信息

其實Ubuntu18.04版之前的任一版更改apt源為國內源方法早就有了,其實每一版內容不同的地方就是版本號(或者官方一點的說:系統代號)

使用如下命令:

lsb_release -c

得到本系統的系統代號,如下圖所示:

技術分享圖片

我們可以看到的Ubuntu18.04系統代號為bionic

同樣的我們也可以得到任意版本的系統代號:

Ubuntu 12.04 (LTS)代號為precise。

Ubuntu 14.04 (LTS)代號為trusty。

Ubuntu 15.04 代號為vivid。

Ubuntu 15.10 代號為wily。

Ubuntu 16.04 (LTS)代號為xenial。

Ubuntu 18.04 (LTS)代號為bionic

3.將原有的內容註釋掉,添加以下內容

# 阿裏雲源:(Ubuntu 18.04 (LTS)代號為bionic)

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

sources.list文件的條目格式,一般有如下形式

  1. deb http://site.example.com/debian distribution component1 component2 component3
  2. deb-src http://site.example.com/debian distribution component1 component2 component3

所以後面幾個參數是對軟件包的分類(Ubuntu下是main, restricted,universe ,multiverse這四個)

所以你把內容寫成

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse

之類的也是可以的,之前我有這個疑惑,所以在這裏一並告知和我有一樣疑惑的朋友。

4.更新軟件列表、更新軟件包

sudo apt-get update # 更新軟件列表

sudo apt-get upgrade # 更新軟件包

5. 關於sudo apt-get update與sudo apt-get upgrade區別:https://blog.csdn.net/beckeyloveyou/article/details/51352426

6.其他一些命令

sudo apt-get update 更新源
sudo apt-get install package 安裝包
sudo apt-get remove package 刪除包
sudo apt-cache search package 搜索軟件包
sudo apt-cache show package 獲取包的相關信息,如說明、大小、版本等
sudo apt-get install package --reinstall 重新安裝包
sudo apt-get -f install 修復安裝
sudo apt-get remove package --purge 刪除包,包括配置文件等
sudo apt-get build-dep package 安裝相關的編譯環境
sudo apt-get upgrade 更新已安裝的包
sudo apt-get dist-upgrade 升級系統
sudo apt-cache depends package 了解使用該包依賴那些包
sudo apt-cache rdepends package 查看該包被哪些包依賴
sudo apt-get source package 下載該包的源代碼
sudo apt-get clean && sudo apt-get autoclean 清理無用的包
sudo apt-get check 檢查是否有損壞的依賴

東北大學源

deb-src http://mirror.neu.edu.cn/ubuntu/ xenial main restricted #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted
deb-src http://mirror.neu.edu.cn/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security universe
deb http://mirror.neu.edu.cn/ubuntu/ xenial-security multiverse

清華大學源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse

阿裏雲源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

中科大源

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricteddeb 
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

網易源

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

以下內容尚未確定,謹慎使用!

# 默認註釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消註釋

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 預發布軟件源,不建議啟用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse

Ubuntu 各版本的幾個國內更新源