1)备份源文件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2)查看版本信息
如是Linux Mint等Ubuntu衍生版,执行:
cat /etc/upstream-release/lsb-release
如是Ubuntu直接执行:
lsb_release -c
确认当前系统代号(Codename)为:bionic。如是其他版本,请使用其他版本的软件源,其中:
Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。
Ubuntu 18.04 (LTS)代号为bionic
3)修改sources.list:
修改/etc/apt/sources.list为以下内容:
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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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
3.1) for Ubunto 20
sudo sed "s/bionic/$(lsb_release -c | awk '{print $2}')/g" /etc/apt/sources.list
4)检查更新
sudo apt-get update
5)可选操作:移除原有源
cd /etc/apt/sources.list.d
sudo mv official-package-repositories.list official-package-repositories.list.bak