在安装一些软件时候如果使用系统默认的仓库安装速度慢倒是小事,但是有些软件宝死活安装不上就忍不了了,所以很有必要换一个仓库
本文以切换到阿里源为例
1、先找到系统代号
lsb_release -a
2、打开阿里源查看是否有和系统对应的
3、修改 /etc/apt/sources.list
把文件中的内容全部替换成下面的即可(改之前备份不备份自己拿捏)
把里下面代码中的所有 TODO 改成你的系统代号名称,比如我的系统是 impish 就需要把下面所有的 TODO 替换成 impish, 然后保存即可
ubuntu 改为如下内容
deb http://mirrors.aliyun.com/ubuntu/ TODO main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ TODO main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ TODO-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ TODO-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ TODO-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ TODO-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ TODO-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ TODO-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ TODO-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ TODO-backports main restricted universe multiverse
debian 改为如下内容
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
4 更新缓存和升级
分别执行下面这两条命令
sudo apt-get update
sudo apt-get upgrade