首页 > linux > ubuntu > 6.ubuntu apt-get切换源

6.ubuntu apt-get切换源

更改apt-get源地址为国内阿里源.

1 修改源地址

修改前先备份一下原始的sources.list文件。

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

修改sources.list文件

sudo vi /etc/apt/sources.list

以下是ubuntu Trusty(14.04) 阿里云apt-get源将以下内容粘贴进sources.list文件中:

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

2 更新源

通过apt-get update更新源。这样配置的国内源就生效了。

sudo apt-get update
转载请保留原文链接.