Ubuntu 配置阿里云 apt-get 源

1) 查看自己的Ubuntu系统的Codename,这一步很重要,直接导致你更新的源是否对你的系统起效果,查看方法:

lsb_release -a

如,我的系统显示:

root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty

这里显示了一些ubuntu的版本信息,需要得到的是Codename,比如,我这里是 trusty

2) 确认阿里源支持:

登陆以下网页:http://mirrors.aliyun.com/ubuntu/dists/

该网页显示了阿里云支持的ubuntu系统下各个Codename版本,确保自己的Codename在该网页中存在(一般都会有的)

3) 备份系统源:

 cd /etc/apt
 mv sources.list sources.list.bak

4) 添加新的源文件:

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

5) 保存并且sudo apt-get update,更新成功

内容整理自互联网。

你可能感兴趣的:(linux)