发现好多vps默认的Debian使用 apt install 安装软件的时候都会报 404 Not Found 的错误,apt update 也不行
应该是 sources.list 里面的源地址问题,以cloudcone的为例,我直接修改成最新的Debian官方源就可以了
一)备份
mv /etc/apt/sources.list /etc/apt/sources.list.old
二)替换(直接一次性复制多行命令粘贴运行就行,或者也可以自己vi更换相关内容)
官方源
cat > /etc/apt/sources.list << EOF deb https://deb.debian.org/debian/ bullseye main contrib non-free deb-src https://deb.debian.org/debian/ bullseye main contrib non-free deb https://deb.debian.org/debian/ bullseye-updates main contrib non-free deb-src https://deb.debian.org/debian/ bullseye-updates main contrib non-free deb https://deb.debian.org/debian/ bullseye-backports main contrib non-free deb-src https://deb.debian.org/debian/ bullseye-backports main contrib non-free deb https://deb.debian.org/debian-security/ bullseye-security main contrib non-free deb-src https://deb.debian.org/debian-security/ bullseye-security main contrib non-free EOF
清华源
cat > /etc/apt/sources.list << EOF deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free EOF
中科大源
cat > /etc/apt/sources.list << EOF deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free EOF
阿里云源(公网)
cat > /etc/apt/sources.list << EOF deb https://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb-src https://mirrors.aliyun.com/debian/ bullseye main contrib non-free deb https://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main contrib non-free deb https://mirrors.aliyun.com/debian/ bullseye-backports main contrib non-free deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main contrib non-free deb https://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free EOF
阿里云内网源(阿里云服务器使用,不消耗公网流量)
cat > /etc/apt/sources.list << EOF deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye main contrib non-free deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye main contrib non-free deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-updates main contrib non-free deb http://mirrors.cloud.aliyuncs.com/debian/ bullseye-backports main contrib non-free deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-backports main contrib non-free deb http://mirrors.cloud.aliyuncs.com/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.cloud.aliyuncs.com/debian-security/ bullseye-security main contrib non-free EOF
腾讯云源(公网)
cat > /etc/apt/sources.list << EOF deb https://mirrors.cloud.tencent.com/debian/ bullseye main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ bullseye main contrib non-free deb https://mirrors.cloud.tencent.com/debian/ bullseye-updates main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-updates main contrib non-free deb https://mirrors.cloud.tencent.com/debian/ bullseye-backports main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-backports main contrib non-free deb https://mirrors.cloud.tencent.com/debian-security/ bullseye-security main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian-security/ bullseye-security main contrib non-free EOF
腾讯云内网源(阿里云服务器使用,不消耗公网流量)
cat > /etc/apt/sources.list << EOF deb http://mirrors.tencentyun.com/debian/ bullseye main contrib non-free deb-src http://mirrors.tencentyun.com/debian/ bullseye main contrib non-free deb http://mirrors.tencentyun.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.tencentyun.com/debian/ bullseye-updates main contrib non-free deb http://mirrors.tencentyun.com/debian/ bullseye-backports main contrib non-free deb-src http://mirrors.tencentyun.com/debian/ bullseye-backports main contrib non-free deb http://mirrors.tencentyun.com/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.tencentyun.com/debian-security/ bullseye-security main contrib non-free EOF
Linode源
cat > /etc/apt/sources.list << EOF deb http://mirrors.linode.com/debian/ bullseye main contrib non-free deb-src http://mirrors.linode.com/debian/ bullseye main contrib non-free deb http://mirrors.linode.com/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.linode.com/debian/ bullseye-updates main contrib non-free deb http://mirrors.linode.com/debian/ bullseye-backports main contrib non-free deb-src http://mirrors.linode.com/debian/ bullseye-backports main contrib non-free deb http://mirrors.linode.com/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.linode.com/debian-security/ bullseye-security main contrib non-free EOF
三)更新索引
apt update