红联Linux门户
Linux帮助

Linux系统(Ubuntu14.04/16.04)中使用国内的源地址

发布时间:2017-03-24 09:59:32来源:linux网站作者:陈南志
1、源地址列表文件路径
ubuntu系统的源列表配置文件的路径是:/etc/apt/ sources.list
为了在替换前留个备份,可以执行命令做个备份:
cp  /etc/apt/sources.list   /etc/apt/sources.list-bak
 
2、源地址列表文件的替换
不同的版本,sources.list里的url是不同的,主要是版本好不一样,例如ubuntu14.04的代号是trusty ,而ubuntu16.04是 xenial。
具体查看方法是执行命令:lsb_release  -a 回车
返回的Codename就是版本代号
如图:
Linux系统(Ubuntu14.04/16.04)中使用国内的源地址
 
2.1、ubuntu14.04版本
将/etc/apt/ sources.list的内容替换为:
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 apt-get  update
 
2.2、ubuntu16.04版本
将/etc/apt/ sources.list的内容替换为:
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
替换后执行命令:sudo apt-get  update
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29430.html