2018-11-24 By Stone_Hou
1. 備份源列表
Ubuntu缺省的配置的源并不是國內的服務器骇吭,下載更新軟件都比較慢怖糊,本文介紹如何設置源列表,選擇比較快的源以節(jié)省下載時間悬钳。
# 首先備份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2. 打開sources.list文件修改
選擇合適的源塞蹭,替換原文件的內容,保存編輯好的文件, 以阿里云更新服務器為例(從實際測試上結果分析门坷,個人認為阿里云比網(wǎng)易和搜狐的服務器要快):
sudo vim /etc/apt/sources.list
3. 阿里云鏡像源-清華鏡像源
注意根據(jù)具體使用的Ubuntu的版本不同宣鄙,將文本中trusty替換為下面對應版本的字符串:
版本 | 版本號 | 代號 |
---|---|---|
Lucid(10.04) | 10.04 | lucid |
Precise(12.04): precise | 12.04 | precise |
Trusty(14.04): trusty | 14.04 | trusty |
Utopic(14.10): utopic | 14.10 | utopic |
Ubuntu 16.04 TLS: xenial | 16.04 | xenial |
Ubuntu 18.04 TLS: bionic | 18.04 | bionic |
Ubuntu 18.04 TLS版本阿里云鏡像源:
# https://opsx.alibaba.com/mirror
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# 仿照清華鏡像源,注釋了源碼鏡像以提高 apt update 速度默蚌,如有需要可自行取消注釋
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
Ubuntu 18.04 TLS版本清華鏡像源:
# https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
# 默認注釋了源碼鏡像以提高 apt update 速度冻晤,如有需要可自行取消注釋
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
# 預發(fā)布軟件源,不建議啟用
# 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
4. 刷新列表绸吸,一定要執(zhí)行刷新
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential