共計(jì) 4694 個(gè)字符,預(yù)計(jì)需要花費(fèi) 12 分鐘才能閱讀完成。
本文丸趣 TV 小編為大家詳細(xì)介紹“如何更換 Ubuntu 軟件源”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“如何更換 Ubuntu 軟件源”文章能幫助大家解決疑惑,下面跟著丸趣 TV 小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。
什么是 Ubuntu 的軟件源?
我們?cè)谑褂?Debian 或者 Ubuntu 的 apt-get 工具來(lái)安裝需要的軟件時(shí),其實(shí)就是從服務(wù)器獲取需要安裝的軟件并把它安裝在本地計(jì)算機(jī)的過(guò)程。所謂的軟件源,就是我們獲取軟件的來(lái)源,它是定義在 /etc/apt/sources.list 文件里的。
默認(rèn)的 sources.list 文件內(nèi)容如下:
## deb cdrom:[Ubuntu-Server 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.8)]/ xenial main restricted#deb cdrom:[Ubuntu-Server 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.8)]/ xenial main restricted# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to# newer versions of the distribution.deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted## Major bug fix updates produced after the final release of the## distribution.deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team. Also, please note that software in universe WILL NOT receive any## review or updates from the Ubuntu security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial universe# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universedeb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team, and may not be under a free licence. Please satisfy yourself as to## your rights to use the software. Also, please note that software in## multiverse WILL NOT receive any review or updates from the Ubuntu## security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiversedeb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse## N.B. software from this repository may not have been tested as## extensively as that contained in the main release, although it includes## newer versions of some applications which may provide useful features.## Also, please note that software in backports WILL NOT receive any review## or updates from the Ubuntu security team.deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse## Uncomment the following two lines to add software from Canonical s## partner repository.## This software is not part of Ubuntu, but is offered by Canonical and the## respective vendors as a service to Ubuntu users.# deb http://archive.canonical.com/ubuntu xenial partner# deb-src http://archive.canonical.com/ubuntu xenial partnerdeb http://security.ubuntu.com/ubuntu xenial-security main restricted# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricteddeb http://security.ubuntu.com/ubuntu xenial-security universe# deb-src http://security.ubuntu.com/ubuntu xenial-security universedeb http://security.ubuntu.com/ubuntu xenial-security multiverse# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
可以看到,官方的默認(rèn)源是來(lái)自美國(guó)的 us.archive.ubuntu.com 和 security.ubuntu.com。那么我們?cè)趺礃訐Q成速度更快的國(guó)內(nèi)源呢?很簡(jiǎn)單,把 /etc/apt/sources.list 文件復(fù)制備份一下,然后把原來(lái)的內(nèi)容修改成國(guó)內(nèi)源的網(wǎng)址即可。以下步驟說(shuō)明以阿里云的源為例:
1. 復(fù)制備份原來(lái)的配置文件
sudo cp /etc/apt/sources.list sources.list.bak
2. 使用你喜歡的文本編輯器如 vi/vim/nano,打開(kāi) sources.list 文件,把原來(lái)的內(nèi)容替換成以下內(nèi)容:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse##測(cè)試版源 deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse# 源碼 deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse## 測(cè)試版源 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse# Canonical 合作伙伴和附加 deb http://archive.canonical.com/ubuntu/ xenial partnerdeb http://extras.ubuntu.com/ubuntu/ xenial main
3. 運(yùn)行 sudo apt-get update 命令,更新軟件列表,以后就可以使用阿里云提供的快速源了。同樣的方法,也可以替換為網(wǎng)易源、搜狐源、中科大源、清華大學(xué)源等。
讀到這里,這篇“如何更換 Ubuntu 軟件源”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道。