溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

ubuntu中的sources.list源如何進(jìn)行修改

發(fā)布時(shí)間:2020-11-07 16:34:10 來源:億速云 閱讀:891 作者:Leah 欄目:開發(fā)技術(shù)

今天就跟大家聊聊有關(guān)ubuntu中的sources.list源如何進(jìn)行修改,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

1. 備份源列表

Ubuntu缺省的配置的源并不是國(guó)內(nèi)的服務(wù)器,下載更新軟件都比較慢,本文介紹如何設(shè)置源列表,選擇比較快的源以節(jié)省下載時(shí)間。

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

2. 打開sources.list文件修改

選擇合適的源,替換原文件的內(nèi)容,保存編輯好的文件, 以阿里云更新服務(wù)器為例(從實(shí)際測(cè)試上結(jié)果分析,個(gè)人認(rèn)為阿里云比網(wǎng)易和搜狐的服務(wù)器要快):

sudo vim /etc/apt/sources.list

3. 阿里云鏡像源-清華鏡像源

注意根據(jù)具體使用的Ubuntu的版本不同,將文本中trusty替換為下面對(duì)應(yīng)版本的字符串:

版本版本號(hào)代號(hào)
Lucid(10.04)10.04lucid
Precise(12.04): precise12.04precise
Trusty(14.04): trusty14.04trusty
Utopic(14.10): utopic14.10utopic
Ubuntu 16.04 TLS: xenial16.04xenial
Ubuntu 18.04 TLS: bionic18.04bionic

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/
# 默認(rèn)注釋了源碼鏡像以提高 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

# 預(yù)發(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

看完上述內(nèi)容,你們對(duì)ubuntu中的sources.list源如何進(jìn)行修改有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI