步骤很简单一共三步,如下所示:
第一、备份源文件(防止万一)
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
第二、修改源文件(这里的源文件是你通过vim新建的源文件)
sudo vim /etc/apt/sources.list
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
第三、更新
sudo apt-get update
只要第三步没有出问题,表示你已经成功更新阿里云源成功了。
其实之所以用阿里云源,主要是考虑下载速度方面,阿里云在国内的CDN节点很多,自然下载速度快。从另外一个方面我顺便说说为什么大中型企业为什么要构建自己的maven私服,原因有二,第一,下载速度快;第二,更好管理和迭代版本。比如现在很多公司基本上都使用阿里云的maven仓库。