日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > Ubuntu >内容正文

Ubuntu

Ubuntu切换数据源

發(fā)布時(shí)間:2025/3/19 Ubuntu 59 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Ubuntu切换数据源 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Ubuntu安裝完畢之后,默認(rèn)的源是Ubuntu自己的,但畢竟Ubuntu服務(wù)器在國(guó)外,我們?cè)L問(wèn)起來(lái)會(huì)比較慢,可以將軟件源切換為國(guó)內(nèi)源,比如:阿里源,清華源,中科大源等等。在這邊以清華源為例,其它源也是一樣的道理。

1 切換源之前先把配置文件備份一份:

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

2 找到清華源官網(wǎng):

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

一定要選擇與自己版本相對(duì)應(yīng)的源,比如當(dāng)前使用Ubuntu20.04,最好使用此版本的源,否則有可能會(huì)有意料不到的問(wèn)題,良許就吃過(guò)這方面的虧。

網(wǎng)絡(luò)上也有很多教你換源的帖子,但都是直接給出內(nèi)容,有可能源與自己的版本不一致,所以最好自己去官網(wǎng)復(fù)制。

3.將之前的源全部刪除

echo ” > sources.list

4.編輯新源文件

nano sources.list

5.加入新的數(shù)據(jù)源(清華數(shù)據(jù)源)

# 默認(rèn)注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse# 預(yù)發(fā)布軟件源,不建議啟用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

6.使用新源替換掉原來(lái)的源(一定要加sudo):

sudo vi /etc/apt/sources.list

7.然后更新軟件包緩存:

sudo apt update

這個(gè)命令,會(huì)訪問(wèn)源列表里的每個(gè)網(wǎng)址,并讀取軟件列表,然后保存在本地電腦。

8.通常我們會(huì)緊跟著再執(zhí)行命令:

sudo apt-get upgrade

這個(gè)命令,會(huì)把本地已安裝的軟件,與剛下載的軟件列表里對(duì)應(yīng)軟件進(jìn)行對(duì)比,如果發(fā)現(xiàn)已安裝的軟件版本太低,就會(huì)提示你更新。

9.備用數(shù)據(jù)源【阿里】

在下面網(wǎng)站查找最新數(shù)據(jù)源

https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.b5371b11tio0iu

Ubuntu 14.04.5 LTS為例,最后的效果如下:

deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse## Not recommended # deb https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse # deb-src https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

ubuntu 16.04 配置如下

deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial maindeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates maindeb http://mirrors.aliyun.com/ubuntu/ xenial universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universedeb http://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

ubuntu 18.04(bionic) 配置如下

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

ubuntu 20.04(focal) 配置如下

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backport

總結(jié)

以上是生活随笔為你收集整理的Ubuntu切换数据源的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。