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