Debian9换源

Debian9换源
sjh2020Debian9 换源教程
注意: 如果你购买的 VPS 是 Debian 9 系统,必须换源!!
一些 VPS 厂商的便宜主机还在使用 Debian9 系统,需要正常安装依赖或者软件更新的话需要更新软件源,以下是网上收集的方法。厂商提供的方法已验证可用,第二种方法未完全测试。
一、VPS 厂商提供的方法
Debian 9 需要换源
运行一键换源命令(复制回车即可):
替换为官方源(注意版本):
1 | 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 |
替换为腾讯源(注意版本):
1 | 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 |
任选其一运行,运行后执行以下命令完成换源:
1 | apt-get update -y && apt-get install curl -y && apt-get install sudo -y |
添加 Swap 交换内存:
1 | curl -L https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh && chmod +x addswap.sh && bash addswap.sh |
二、网上搜索的方法
由于 Debian9 已停止维护,目前可用的软件源如下:
1 | deb http://archive.debian.org/debian/ stretch main contrib non-free |
步骤:
1. 设置软件源:
1 | cat > /etc/apt/sources.list |
粘贴以上软件源内容,粘贴完成后按 Ctrl + D 保存并退出。
2. 更新软件源:
1 | apt update -y |
3. GPG 证书错误处理(如有):
报错信息示例:
1 | W: GPG error: http://archive.debian.org/debian stretch-backports InRelease: |
安装依赖:
1 | apt-get install software-properties-common dirmngr -y |
添加 GPG 公钥:
1 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 0E98404D386FA1D9 |
4. 再次执行更新:
1 | apt update -y |
💡 建议: 长期使用 VPS 的用户建议定期备份系统,并优先使用长期支持的系统版本,如 Debian 10 或 Debian 11。
[up主专用,视频内嵌代码贴在这]
评论
匿名评论隐私政策








