更换 Debian 软件源

本文最后更新于 2023年10月19日 凌晨

linux-debian-mirror

运行以下命令备份软件源并配置镜像源

此命令一并更新了「安全更新软件源」,一般而言,为了更及时地获得安全更新,不推荐使用镜像站安全更新软件源,因为镜像站往往有同步延迟。参考 https://www.debian.org/security/faq.en.html#mirror

但实测,使用原始地址非常缓慢,甚至无法连接,所以还是使用了镜像站的安全更新软件源。如果需要使用原始地址,相关配置文档可以参考:https://mirrors.bfsu.edu.cn/help/debian/

1
2
3
sudo sed -e 's|^deb http://deb.debian.org/|deb https://mirrors.bfsu.edu.cn/|g' \
-i.bak \
/etc/apt/sources.list

配置结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.bfsu.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.bfsu.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.bfsu.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.bfsu.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.bfsu.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.bfsu.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.bfsu.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.bfsu.edu.cn/debian-security bookworm-security 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

感谢

感谢 北京外国语大学开源软件镜像站 提供的镜像服务

参考


更换 Debian 软件源
https://blog.cc01cc.cn/2023/03/17/linux-debian-mirror/
作者
零一/cc01cc(zeo)
发布于
2023年3月17日
更新于
2023年10月19日
许可协议