archive.debian.> **TL;DR**:本文详解 Debian 旧版源配置方法,利用国内镜像加速替代缓慢的 archive.debian.org`,快速恢复已停止支持系统的软件包管理能力。
- 核心方案 :将
/etc/apt/sources.list中的archive.debian.org替换为国内镜像站归档地址(如阿里云https://mirrors.aliyun.com/debian-archive/debian/),实现国内镜像加速。- 适用版本:Debian 7(wheezy)、8(jessie)、9(stretch)等已停止支持的旧版系统。
- 操作要点 :替换后执行
sudo apt update,旧版可能需加--allow-releaseinfo-change参数。- 安全提醒 :归档源仅用于临时维护,不建议用于生产环境,应尽快升级到受支持版本。
TL;DR :为已停止支持的旧版 Debian(如 wheezy、jessie、stretch)配置国内归档源,只需将/etc/apt/sources.list中的域名替换为国内镜像站归档地址(如阿里云https://mirrors.aliyun.com/debian-archive/debian/),然后执行sudo apt update。关键注意:归档源仅用于维护旧系统,不建议用于生产环境,应尽快升级到受支持版本。
(已停止支持),不提供国内镜像加速;若需快速下载旧包,应改用国内镜像站的归档地址,格式为 http://archive.debian.org/debian-archive/ + 镜像站路径,但更推荐直接切换到 /etc/apt/sources.list 使用对应旧版代号的国内归档源。
确认你的 Debian 版本代号(如 wheezy、jessie、stretch):运行 lsb_release -a 或查看 /etc/os-release。
备份原 sources.list:
sh
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
替换为国内归档源(以清华大学为例,适用于已停止支持的旧版):
bash
sudo tee /etc/apt/sources.list <<EOF
deb http://archive.debian.org/debian-archive/debian/ <代号> main contrib non-free
deb http://archive.debian.org/debian-archive/debian-security/ <代号>/updates main contrib non-free
EOF
替换 <代号> 为实际版本(如 jessie),注意:国内镜像站(如清华、中科大)通常不单独归档旧版,需直接用 archive.debian.org 域名,但可通过国内 CDN 加速访问------部分镜像站提供 Debian 归档镜像,如阿里云归档或网易归档,可将上述 URL 换成对应国内地址(如 https://mirrors.aliyun.com/debian-archive/debian/)。
若使用国内归档镜像(推荐),例如阿里云:
bash
deb https://mirrors.aliyun.com/debian-archive/debian/ wheezy main contrib non-free
deb https://mirrors.aliyun.com/debian-archive/debian-security/ wheezy/updates main contrib non-free
执行更新:sudo apt update(旧版可能需加 --allow-releaseinfo-change 或禁用 GPG 检查,但注意安全风险)。
若仍慢:检查是否启用 IPv6(sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1)或改用 HTTP(部分归档站 HTTPS 证书过期);也可安装 apt-fast 并行加速。
⚠️ 重要:archive.debian.org 及其镜像仅用于维护已停更系统(如 Debian 7/8/9),不建议用于生产环境;尽快升级到受支持版本(如 Bookworm/Trixie)并使用正常国内源(如 mirrors.tuna.tsinghua.edu.cn/debian/)。
常见错误排查
错误:404 Not Found 与 没有 Release 文件
如果你在配置旧版 Debian 源时遇到以下报错:
text
忽略:1 https://mirrors.aliyun.com/debian buster InRelease
忽略:2 https://mirrors.aliyun.com/debian buster-updates InRelease
错误:3 https://mirrors.aliyun.com/debian buster Release
404 Not Found [IP: 116.196.147.87 443]
错误:4 https://mirrors.aliyun.com/debian buster-updates Release
404 Not Found [IP: 116.196.147.87 443]
正在读取软件包列表... 完成
E: 仓库 "https://mirrors.aliyun.com/debian buster Release" 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
原因分析 :Debian 10(buster)已于 2024 年 6 月停止支持,阿里云等国内镜像站已将其从常规源目录中移除,因此访问 https://mirrors.aliyun.com/debian buster 会返回 404。
解决方案 :与 Debian 7/8/9 一样,buster 也需要切换到归档源。将 sources.list 中的地址改为阿里云归档镜像:
bash
sudo tee /etc/apt/sources.list <<EOF
deb https://mirrors.aliyun.com/debian-archive/debian/ buster main contrib non-free
deb https://mirrors.aliyun.com/debian-archive/debian-security/ buster/updates main contrib non-free
EOF
然后执行更新:
bash
sudo apt update --allow-releaseinfo-change
注意 :
--allow-releaseinfo-change参数用于处理归档源与常规源之间 Release 文件信息的差异,旧版系统更新时通常需要加上此参数。