Linux系列之更新阿里云软件源
- 备份软件源
cd /etc/apt
sudo cp sources.list sources.list.bak
- 修改源文件内容
sudo vim sources.list
vim下输入:%d
删除文件所有内容,并替换成阿里源文件内容:
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
esc->输入 :wq
保存退出。
注意: 修改源文件前先使用命令 lsb_release -c
查看系统代号,Ubuntu18.04系统代号为bionic,上方黄色标记文本可以看到。
Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 16.04 (LTS)代号为xenial。
Ubuntu 20.04 (LTS)代号为focal。
3. 更新软件列表
sudo apt-get update
获取阿里云软件源提供的软件列表 。
sudo apt-get upgrade
更新软件。