【Ubuntu】Ubuntu 18.04 LTS 更換國內源——解決終端下載速度慢的問題

最近裝了ubuntu18.04 LTS,下載軟體有點慢,網上搜了下解決方案,大致是兩種:一、把/etc/apt/sources.list文件里的源更換一下,改成阿里雲或者其它的鏡像

的文件;二、更換software&updates里的select best server

一、更換/etc/apt/sources.list文件里的源

1. 備份源列表

Ubuntu配置的默認源並不是國內的伺服器,下載更新軟體都比較慢。首先備份源列表文件sources.list

# 首先備份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

2. 打開sources.list文件修改

選擇合適的源,替換原文件的內容,保存編輯好的文件, 以阿里雲更新伺服器為例(可以分別測試阿里雲、清華、中科大、163源的速度,選擇最快的):

# 打開sources.list文件
sudo gedit /etc/apt/sources.list

編輯/etc/apt/sources.list文件, 在文件最前面添加阿里雲鏡像源:

# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

3. 刷新列表

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential

下載速度瞬間就起飛了。

4. 其他源

中科大源:

# 中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源:

# 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清華源:

# 清華源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

更換sources.list速度依然還是很慢就請繼續往下看第二種方法。

二、更換software&updates里的select best server

這種方法不需要改什麼文件,直接在select best server里自動選擇。

1. 首先在Show Applications找Software & Updates:

搜索software & updates

打開software & updates

2. 打開software & updates,download from里選擇other:

download from選擇other

3. 然後點擊select best server按鈕,它會找到最快的那個,然後點擊choose server,就選好鏡像了:

我這裡搜到的阿里雲的源:

4. 把other software選項中除了阿里雲的鏡像源的對勾都去掉了,目前沒有啥影響:

5. 終端里輸入sudo apt-get update,速度瞬間快的飛起。

sudo apt-get update

參考

1. 修改ubuntu 18.04的sources.list源為阿里或清華鏡像

2. Ubuntu16.04換國內最快源


推薦閱讀:

win10+ubuntu雙系統雙硬碟安裝及配置
CUDA/cuDNN(ubuntu18.04 + 1050Ti)
安卓下安裝ubuntu+nginx+mysql+內網穿透

TAG:Ubuntu | Ubuntu18.04 |