Ubuntu18.04 更換源


在虛擬機新建一個Ubuntu18.04.1-live-server-amd64當做服務器

在安裝軟件時報錯:

slave@slave:~$ sudo -s
[sudo] password for slave:

 

root@slave:~# apt install redis-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.6.5-3ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.

 

root@slave:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded. 

從報錯信息上看可能存在一些依賴問題或者軟件源出了問題,修復一下破損的依賴關系還是一樣的錯誤信息,此時應該更換Ubuntu的源。

 

如何更換Ubuntu的源

①進入root模式

sudo -s

②進入ubuntu源的目錄 

cd /etc/apt

③備份sources.list

cp sources.list sources.list.bak

④修改sources.list

刪除sources.list中的內容,把阿里雲的源復制進source.list中

vi sources.list

 

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 multiverse

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

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

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

  

⑤ 更新源

apt update

 

  

6. 更新軟件

apt upgrade 

 

  

 

再次安裝軟件就不會報錯了  

 

 

 

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM