【转载】Linux系统之Ubuntu 16.04更换apt软件源

1. 找到并备份配置文件sources.list

我们需要对apt源的配置文件进行修改 。进入/etc/apt目录,我们可以看到sources.list文件。

为了保证安全,我们在修改前先把sources.list文件进行备份

cp sources.list sources.list.bak

2. 修改配置文件sources.list

建议先安装vim编辑工具,因为自带的vi特别难用,vim是vi的增强版。

apt-get install vim

vi或者vim操作sources.list文件,先清空原有的内容(官方源)。然后再把下面的阿里源复制进去。

阿里源Ubunt16.04(xenial)版本

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted 
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe 
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

3. 更新源 + 更新软件

3.1 更新源

apt-get update

3.2 更新软件

apt-get upgrade