Ubuntu换源

前言:按照网上换源的方法出现:Unable to correct problems, you have held broken packages

一、查看系统Codename:

lsb_release -a

Ubuntu换源_第1张图片

或者

cat /etc/apt/sources.list

Ubuntu换源_第2张图片

二、确认阿里源支持:登陆以下网页:http://mirrors.aliyun.com/ubuntu/dists/

Ubuntu换源_第3张图片

三、更换源

sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak
sudo vi /etc/apt/sources.list

以下内容:注意,每一行的bionic应该用第一步查看得到的Codename来代替

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

四、更新

更新源

sudo apt-get update

修复损坏的包,重新安装正确版本

sudo apt-get -f install

更新软件

 sudo apt-get upgrade

你可能感兴趣的:(Ubuntu换源)