Ubuntu 20.04 更换 apt 源

  1. 备份/etc/apt/sources.list 文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  1. 编辑/etc/apt/sources.list文件, 我用的nano,也可以用别的编辑器编辑,比如vim
sudo nano /etc/apt/sources.list
  1. 在文件前面添加下面的条目(阿里源)
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  1. 更新
sudo apt-get update

如果如出现依赖问题

sudo apt-get -f install

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