Ubuntu 16.04添加阿里云源

转自:http://www.cnblogs.com/EasonJim/p/7119156.html

添加国内源有个好处,比如下载软件时直接时国内的服务器,速度有保证。

以下是操作方法:

1、备份

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

2、编辑

sudo gedit /etc/apt/sources.list

提示:可以使用vi、vim这些

3、覆盖源文件的所有内容

复制代码
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted 
#Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
#Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
#Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
#Added by software-properties deb http://archive.canonical.com/ubuntu xenial partner deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
#Added by software-properties deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
复制代码

4、更新

复制代码
#升级软件列表
sudo apt-get update
#系统将现有的Package升级,如果有相依性的问题,而此相依性需要安装其它新的Package或影响到其它Package的相依性时,此Package就不会被升级,会保留下来。
#还有种说法时更新软件,但是会更新系统内核,大版本不变,不完全可靠的消息,没经过测试
sudo apt-get upgrade
#可以聪明的解决相依性的问题,如果有相依性问题,需要安装/移除新的Package,就会试着去安装/移除它。会识别出当依赖关系改变的情形并作出处理,而upgrade对此情形不处理。
sudo apt-get dist-upgrade
复制代码

提示:通常更新源之后只需要升级软件列表即可。其余两项小心使用。

 

参考:

http://mirrors.aliyun.com/(更多源参考阿里云官方提供的源列表)

http://mirrors.163.com/(更多源参考163官方提供的源列表)

http://blog.csdn.net/paincupid/article/details/52895676

http://www.2cto.com/os/201301/183519.html

http://www.baiyuxiong.com/?p=529

posted @ 2017-09-18 13:54  fenghongyu  阅读(2900)  评论(0编辑  收藏  举报