Ubuntu18.04更换镜像源

换成国内最快的阿里云源

第一步:备份原来的源文件

#切换到apt配置文件的目录
cd /etc/apt/
#备份source.list
sudo cp sources.list sources.list.bak 

 

第二步:替换源

使用vi文本编辑器打开source.list,需要加上sudo即使用管理员权限打开

sudo gedit source.list

将source.list内容清空,粘帖下面的阿里云的镜像地址,保存并退出

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  
# Canonical 合作伙伴和附加  
deb http://archive.canonical.com/ubuntu/ xenial partner  
deb http://extras.ubuntu.com/ubuntu/ xenial main  

 

第三步:更新源和软件

sudo apt-get update 更新源  
sudo apt-get upgrade 更新软件 

 

你可能感兴趣的:(linux)