Ubuntu16.04 替换阿里云软件源

Ubuntu16.04 替换阿里云软件源

一,首先为源文件做备份

1,进入源文件 sources.list 所在的目录:

cd /etc/apt/

Ubuntu16.04 替换阿里云软件源_第1张图片

2,对源文件进行备份

执行命令:

sudo cp sources.list sources.list.bak

二,修改源文件 sources.list 里的内容

1,复制以下阿里云软件源文件内容:

#deb包
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
##测试版源  
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  
# 源码  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
##测试版源  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  

如要用于其他版本,把 xenial 换成版本代号就好:

ubuntu16.04 - xenial 
ubuntu15.10 - willy
ubuntu14.04 - trusty
ubuntu12.04 - precise

2,打开 sources.list 文件,并删除里面所有内容
打开文件:

 sudo vi sources.list

将复制的内容粘贴到本文件中

Ubuntu16.04 替换阿里云软件源_第2张图片

最后: 输入:wq保存退出!

三,更新源和软件

sudo apt-get update

你可能感兴趣的:(linux)