对于中国境内的用户,建议使用清华大学(Tsinghua) 或中科大的 Debian 镜像源,它们在国内访问速度快且稳定。
推荐的清华大学镜像源配置:
编辑 /etc/apt/sources.list 文件:
vim /etc/apt/sources.list
删除原有内容,添加以下内容:
# 清华大学镜像源(推荐)
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
# 或者使用 HTTP 版本(如果 HTTPS 有问题)
# deb http://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
备用:中科大镜像源:
# 中科大镜像源
deb https://mirrors.ustc.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ trixie-security main contrib non-free non-free-firmware
其他可用镜像源:
阿里云:
deb https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware
网易:
deb http://mirrors.163.com/debian/ trixie main contrib non-free non-free-firmware
华为云:
deb https://mirrors.huaweicloud.com/debian/ trixie main contrib non-free non-free-firmware
更新步骤:
- 编辑源文件:
vim /etc/apt/sources.list
(删除所有内容,粘贴上述其中一个配置)
- 更新软件源:
apt update
- 安装 sudo(如果需要):
apt install sudo
如果 HTTPS 连接有问题,可以使用 HTTP:
清华大学 HTTP 源:
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
重要提示:
- 确保网络连接正常,如果仍然无法解析域名,可能是 DNS 问题:
# 检查 DNS 配置
cat /etc/resolv.conf
- 如果 DNS 有问题,可以临时修改:
echo "nameserver 114.114.114.114" > /etc/resolv.conf
echo "nameserver 223.5.5.5" >> /etc/resolv.conf
- 测试网络:
ping -c 3 mirrors.tuna.tsinghua.edu.cn
清华大学镜像源通常是最稳定可靠的选择,建议优先使用。如果遇到 HTTPS 证书问题,可以切换到 HTTP 版本。
评论区