Ubuntu 18 04更換apt get源的方法

2022-09-26 13:39:30 字數 1622 閱讀 4395

使用apt-get安裝時,會很慢,更換了國內的源後,就可以解決這個問題了。

1. 備份sources.list檔案

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

2. 開啟sources.list檔案

sudo gedit /etc/apt/sources.list

3. 刪除原內容,新增下列內容

#清華源

deb bionic main restricted universe multiversedeb-src bionic main restricted universe multiversedeb bionic-updates main restricted universe multiversedeb-src bionic-updates main restricted universe multiversedeb bionic-backports main restricted universe multiversedeb-src bionic-backports main restricted universe multiversedeb bionic-sec程式設計客棧urity main restricted universe multiversedeb-src bionic-security main restricted universe multiversedeb bionic-proposed main restricted universe multiversedeb-src bionic-proposed main restricted universe multiverse

#阿里雲源

deb bionic main restricted universe multiverse

deb bionic-security main restricted universe multiverse

deb bionic-updates main restricted universe multiverse

deb bionic-proposed main restricted universe multiverse

deb bionic-backports main restricted universe multiverse

deb-src bionic main restricted universe multiverse

deb-src bi程式設計客棧on程式設計客棧ic-security main restricted universe multiverse

deb-src bionic-updates main restricted universe multiverse

deb-src h程式設計客棧ttp: bionic-proposed main restricted universe multiverse

deb-src bionic-backports main restricted universe multivevyohqeddrse

這兩個源都可以用,我都試過,感覺阿里雲源速度更快。

4. 更新

儲存sources.list檔案後需要更新apt-get。

sudo apt-get update

更新完成後就可以正常使用了。

Ubuntu18 04更換國內源和apt常用的命令

mv etc apt sources.list etc apt sourses.list.backup 163源 deb bionic main restricted universe multiverse deb bionic security main restricted universe m...

Ubuntu18 04更換國內源

sudo cp etc apt sources.list etc apt sourses.list.backup 163源 deb bionic main restricted universe multiverse deb bionic security main restricted unive...

Ubuntu18 04 更換 國內源

1.進入root模式sudo s 2.進入ubuntu源的目錄cd etc apt 3.備份sources.listcp sources.listsources.list.bak 4.修改sources.list 刪除sources.list中的內容,把阿里雲的源複製進source.list中 ge...