一,备份原来的源文件
1,首先,进入源文件 sources.list 所在的目录:
cd /etc/apt/
2,执行sudo cp sources.list sources.list.bak
对源文件进行备份,以防万一;
二,修改源文件内容
1,阿里云软件源的文件的内容如下:
deb包
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
测试版源
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
源码
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
测试版源
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ xenial partner
deb http://extras.ubuntu.com/ubuntu/ xenial main
2,将上述的阿里云的源文件内容全部复制先
使用sudo vim sources.list打开文件,输入ggdG删除所有内容(这句指令可以理解为从第1行到最后1行之间的内容都删了)
将复制的内容粘贴到本文件中;输入:wq保存退出;
三,更新源和软件
1,使用sudo apt-get update
即可更新获取 阿里云软件源 提供的软件列表;
2,使用sudo apt-get upgrade
即可更新软件;