更换 Debian 软件源

2023-03-17 · 207 字 · 约 1 分钟

本文最后更新于 2023-10-19,部分内容可能已过时。

# linux-debian-mirror

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

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

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

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

# 配置结果

# 默认注释了源码镜像以提高 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

# 感谢

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

# 参考