首页 > 代码库 > Ubuntu 16.04添加阿里云源

Ubuntu 16.04添加阿里云源

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

以下是操作方法:

1、备份

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

2、编辑

sudo gedit /etc/apt/source.list

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

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

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricteddeb-src http://archive.ubuntu.com/ubuntu xenial main restricted 
#Added by software-propertiesdeb http://mirrors.aliyun.com/ubuntu/ xenial main restricteddeb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe
#Added by software-propertiesdeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricteddeb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe
#Added by software-propertiesdeb http://mirrors.aliyun.com/ubuntu/ xenial universedeb http://mirrors.aliyun.com/ubuntu/ xenial-updates universedeb http://mirrors.aliyun.com/ubuntu/ xenial multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
#Added by software-propertiesdeb http://archive.canonical.com/ubuntu xenial partnerdeb-src http://archive.canonical.com/ubuntu xenial partnerdeb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricteddeb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe
#Added by software-propertiesdeb http://mirrors.aliyun.com/ubuntu/ xenial-security universedeb 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://blog.csdn.net/paincupid/article/details/52895676

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

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

Ubuntu 16.04添加阿里云源