参考链接
https://blog.csdn.net/peng2hui1314/article/details/113247648
https://blog.stiny.cn/archives/589.html
https://mirrors.tuna.tsinghua.edu.cn/help/debian/
查看当前镜像源
less -N /etc/apt/sources.list
可以看到使用的是Debian 默认的源地址 http://deb.debian.org/
备份
没人希望出问题,但是还是要备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak
修改文件
使用vim打开文件
sudo vim /etc/apt/sources.list
# 打开文件后直接输入 ggdG 清空文件
ggdG
将以下代码输入空文件内(下面代码来自清华大学开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/debian/)
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
更新镜像源
sudo apt-get update