ubuntu更换阿里源

lsb_release -a
查看Codename,在后面需要把trusty更换为它.

查看阿里源是否有你的Codename:
http://mirrors.aliyun.com/ubuntu/dists/

添加新的源文件:
sudo vi sources.list

并添加以下内容:注意,每一行的trusty应该用第一步查看得到的Codename来代替

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

sudo sed -i.bak s/trusty/Codename/g /etc/apt/source.list`


保存并且执行如下命令,更新成功:
sudo apt-get update

最后附上我用的源:

# 搜狐源
deb http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.sohu.com/ubuntu/ xenial universe
deb-src http://mirrors.sohu.com/ubuntu/ xenial universe
deb http://mirrors.sohu.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates universe
deb http://mirrors.sohu.com/ubuntu/ xenial multiverse
deb-src http://mirrors.sohu.com/ubuntu/ xenial multiverse
deb http://mirrors.sohu.com/ubuntu/ xenial-updates multiverse
deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse
# 网易源:
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.163.com/ubuntu/ xenial universe
deb-src http://mirrors.163.com/ubuntu/ xenial universe
deb http://mirrors.163.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.163.com/ubuntu/ xenial-updates universe
deb http://mirrors.163.com/ubuntu/ xenial multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
# ali源
deb http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main multiverse restricted universe

你可能感兴趣的:(ubuntu更换阿里源)