ubuntu/linux换源

2022-6-27 626 6/27

伺服器自带的源不好用,上手之前建议先换源(根据自己的网去尝试,选择最快的一个)

修改文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old #先给原来的源备份
sudo vim /etc/apt/sources.list #创建新的文件写入源

写入下列内容

Ubuntu 20.04软件源,点击即复制

#添加阿里源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

#添加清华源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse

另附其他版本地址:
阿里云开源镜像站
清华大学(IPv4+IPv6)
中科大 (IPv4+IPv6)

更新

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

如果出现依赖问题(报错)就执行该命令然后重新更新

sudo apt -f install
- THE END -
Tag:

懒人

9月29日16:47

非特殊说明,本博所有文章均为博主原创。