一、选择Archive源
目前Debian archive官方源及国内镜像主要有以下几个,按照推荐的顺序自上而下排列。翻看了一圈国内的镜像站发现archive非商业源很少,商业源中阿里云较为稳定但目前对外限速非常严重,不推荐使用。

官方(海外):http://archive.debian.org/
腾讯云:http://mirrors.cloud.tencent.com/debian-archive/
南京大学:https://mirror.nju.edu.cn/debian-archive/
软件所:https://mirror.iscas.ac.cn/debian-archive/
网易163:http://mirrors.163.com/debian-archive/
阿里云:http://mirrors.aliyun.com/debian-archive/

二、配置镜像源
Debian的镜像源主要分为主线、updates、backports三项。既然已经是过了支持期的老旧系统,updates条目博主觉得不是必要的内容了,要更新还是建议更新到在支持期内的新系统。backports源中的内容是将新版本的某些功能移植到旧版本软件上,如果你不知道它的作用也不必添加。所以一般情况下仅配置主源就够了,再按照需求决定是否添加backports源。

Sources.list

# 基础源
deb [check-valid-until=no] http://archive.debian.org/debian/ stretch main non-free contrib
deb-src [check-valid-until=no] http://archive.debian.org/debian/ stretch main non-free contrib

# Sercurity Updates源
deb [check-valid-until=no] http://archive.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src [check-valid-until=no] http://archive.debian.org/debian-security/ stretch/updates main contrib non-free

# backports源
deb [check-valid-until=no] http://archive.debian.org/debian/ stretch-backports main non-free contrib
deb-src [check-valid-until=no] http://archive.debian.org/debian/ stretch-backports main non-free contrib

其中系统版本是可以替换的,Debian9代号stretch,Debian8代号jessie,Debian7代号wheezy,Debian6代号squeeze。替换为需要的镜像源和版本后,使用vi、nano等工具,覆盖到/etc/apt/sources.list即可。

三、一键更换
以下提供几个博主写好的配置供一键替换,其中只启用了Debian的主源,有额外的需要请自行取消注释。里面的条目没有使用https,因为部分系统没有安装apt-transport-https包。对较早的Debian6-8在此使用的是以前写的Snapshot源,正常使用是没有问题的。

#备份源文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak

#替换为官方源(注意版本)
wget -O /etc/apt/sources.list https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Debian-9-archive.list
wget -O /etc/apt/sources.list https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Debian-8-Snapshot.list
wget -O /etc/apt/sources.list https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Debian-7-Snapshot.list
wget -O /etc/apt/sources.list https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Debian-6-Snapshot.list

#替换为腾讯源(注意版本)
wget -O /etc/apt/sources.list https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Debian-9-archive-qcloud.list

四、结语
最后还是得说一句,虽然更换Archive源能够保证系统基础功能正常,但是已经进入EoL的系统失去了官方的更新和维护,日后有可能会因为一些漏洞而被入侵,如果可以的话还是建议更新到最新版本受支持的系统。

Debian
Debian的源备份有两种,除了我们上面提到的最终源Debian Archive,还有定时备份的快照镜像Snapshot,可以按照自己的需求去选择。

Debian Snapshot:http://snapshot.debian.org/

Ubuntu
遇到Ubuntu旧版系统源404的问题,可以使用Old Release源。

Ubuntu Old Release:http://old-releases.ubuntu.com/ubuntu/
Old Release镜像:http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/

CentOS
关于CentOS旧版系统源404的问题,博主曾经的文章有写过,在这里就不再赘述了。

文档更新时间: 2023-08-29 05:46   作者:月影鹏鹏
IT运维支持-AIWALY-月影工作室