Proxmox8 修改 ustc源
修改 Proxmox VE 8 (PVE8) 的软件源为中科大(USTC)镜像,需要同时修改 Debian 系统源、PVE 软件源 以及可选的 Ceph 分布式存储源 和 LXC 容器模板源。
PVE8 基于 Debian 12 (Bookworm),请在 PVE 的 Shell 控制台中依次执行以下操作:
1. 修改 Debian 系统源
将 Debian 官方源替换为中科大镜像,并备份原文件:
# 备份原有的系统源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 替换为中科大 bookworm 镜像源
cat > /etc/apt/sources.list << 'EOF'
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
EOF
2. 修改 PVE 软件源(非企业订阅版)
PVE 默认启用的是企业版订阅源,非企业用户无法更新。我们需要关闭它并换成中科大的非订阅(no-subscription)源:
# 屏蔽或删除默认的企业源
if [ -f /etc/apt/sources.list.d/pve-enterprise.list ]; then
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak
fi
# 添加中科大 PVE 无订阅源
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
3. 修改 Ceph 源(可选)
如果你在 PVE 中使用了 Ceph 分布式存储(PVE8 默认主要使用 ceph-quincy),可以顺便将其源一并替换:
# 屏蔽默认的 ceph 企业源
if [ -f /etc/apt/sources.list.d/ceph.list ]; then
mv /etc/apt/sources.list.d/ceph.list /etc/apt/sources.list.d/ceph.list.bak
fi
# 添加中科大 Ceph 无订阅源
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph.list
4. 修改 LXC 容器模板源(可选但建议)
更换此源后,在 PVE 的 local 存储中下载 CT Templates (LXC 容器模板) 时速度会大幅提升:
# 备份并替换 APLInfo.pm 中的官方下载地址
cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm.bak
sed -i 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
# 重启 PVE 核心守护进程使 LXC 模板源生效
systemctl restart pvedaemon.service
5. 更新系统
配置完成后,刷新软件源索引并更新系统软件包。为防止 https 证书问题导致报错,建议先带上 --fix-missing 安装证书:
apt update && apt install -y apt-transport-https ca-certificates --fix-missing
apt update && apt dist-upgrade -y
💡 顺带一提(删除未订阅弹窗):
如果每次登录 PVE Web 界面都讨厌弹出的“无有效订阅”提示,换完源后可以顺手跑一下这行命令,然后重启浏览器(或 Ctrl+F5 强制刷新)即可消除弹窗:sed -Ezi.bak "s/(Ext.Msg.show\(\{\s+title: gettext\(\'No valid sub)/void\(\{ \/\/\1/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && systemctl restart pveproxy.service
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
小菜鸡
评论已关闭