Debian系统软件源更换指南:国内镜像源配置与优化

上云教程

Debian系统软件源更换指南:国内镜像源配置与优化

2026-06-22 17:53







国内用户在使用Debian系统时,常因官方源访问速度慢而影响软件更新效率。通过更换为国内镜像源(如阿里云、清华大学、中科大等),可显著提升下载速度5-10倍。本文详细介绍配置步骤、注意事项及问题解决方案。

配置步骤

备份原始源文件

修改前务必备份,防止配置错误导致系统不可用

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

编辑源配置文件

使用 nanovim 编辑器打开文件:

sudo nano /etc/apt/sources.list

替换为国内镜像源

删除原有内容,根据Debian版本选择以下配置之一:

阿里云镜像源(推荐)

deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib

deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib

deb https://mirrors.aliyun.com/debian-security/ bookworm-security main

deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main

deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib

deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib

deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib

清华大学镜像源

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-security bookworm-security main contrib non-free non-free-firmware

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

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

deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

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

更新软件包索引

保存文件后执行以下命令:

sudo apt update && sudo apt upgrade -y