Ubuntu虛擬機更換源

更換源

沒有更換源,直接用sudo apt install xxx會十分的慢,因爲它是從國外的服務器中下載,所以我選擇換用國內的源,體驗一下飛一般的下載的快樂。

操作步驟指南博客

這是原博==

其實就是那麼幾步,首先

#備份源文件列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup  #其實後面那個文件名稱可以隨便填,只是留個副本

然後打開源文件列表(我用的是vim,原博用的是別的文檔操作的軟件)

sudo vim /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

也可以換別的源,原博給了好多源,反正我用的是阿里源,所以這裏只寫阿里源。

最後刷新列表。

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

就成功了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章