备份现有apt源配置

mv /etc/apt/sources.list /etc/apt/sources.list.old

替换为其他apt源

这是一条命令,全部复制后,直接粘贴然后一起执行。

  1. 默认官方源source.list
cat > /etc/apt/sources.list << EOF
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free

deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free

deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-backports main contrib non-free

deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
EOF
  1. 腾讯云内网source.list
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

3.阿里云内网源source.list

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/ bullseye-proposed-updates main contrib non-free
deb-src http://mirrors.cloud.aliyuncs.com/debian/ bullseye-proposed-updates 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

  1. Linode源source.list
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

  1. 清华大学source.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

更新软件列表并更新软件

sudo apt update && sudo apt upgrade -y