欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu 更换更新源

程序员文章站 2022-06-14 23:04:26
...

1  备份原来的更新源

cp /etc/apt/sources.list /etc/apt/sources.list.backup

如果提示权限不够就输入下面两行,先进入到超级用户,再备份
sudo -s
cp /etc/apt/sources.list /etc/apt/sources.list.backup

2  修改更新源

  打开sources.list (这就是存放更新源的文件)

sudo vim /etc/apt/sources.list

    1.阿里源     将下面所有内容复制,粘贴并覆盖sources.list文件中的所有内容

    

 

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

 

    2.清华源

      进入网址复制可更改系统版本:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/

3  让更新源生效

sudo apt-get update