跳转至

Proxmox

地址

https://mirrors.ustc.edu.cn/proxmox/

说明

Proxmox 软件源

收录架构

所有 Proxmox 官方支持的架构

收录版本

所有 Proxmox 官方支持的版本

使用说明

Warning

操作前请做好相应备份

Debian,Proxmox

一般情况下,需要同时修改基础系统(Debian)的源文件(/etc/apt/sources.list/etc/apt/sources.list.d/debian.sources)和 Proxmox 的源文件。

修改基础系统(Debian)的源文件,可以参考 Debian 帮助 或使用如下命令:

什么是 DEB822 (.sources) 文件格式?

自新版本的 Debian 与 Ubuntu 起,例如:

  • Debian 13
  • Debian 12 的容器镜像
  • Ubuntu 24.04
  • Proxmox VE 9

默认预装的系统中 APT 的系统源配置文件不再是传统的 /etc/apt/sources.list。传统格式(又被称为 One-Line-Style 格式)类似如下:

deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib

新的 DEB822 格式自 APT 1.1(2015 年发布)起支持,后缀为 .sources,存储在 /etc/apt/sources.list.d/ 目录下,格式类似如下:

Types: deb
URIs: https://mirrors.ustc.edu.cn/debian
Suites: bookworm
Components: main contrib
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

在切换软件源时,需要根据实际情况选择对应的格式进行修改

关于 DEB822 格式的设计考虑,可以参考官方文档(英文)。

sed -i 's|^deb http://ftp.debian.org|deb https://mirrors.ustc.edu.cn|g' /etc/apt/sources.list
sed -i 's|^deb http://security.debian.org|deb https://mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources

目前 Debian Bookworm 及以后的容器镜像和 Debian Trixie 已经使用 DEB822 格式,且其安全更新源默认设置为 http://deb.debian.org/debian-security,因此以上命令会同时替换 Debian 官方源和安全更新源。

修改 Proxmox 的源文件,可以使用如下命令:

echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve trixie pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<EOF
Types: deb
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<EOF
Types: deb
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
Suites: bookworm
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<EOF
Types: deb
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
Suites: bullseye
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF

对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令中的 pve 分别替换为 pbspmg

PVE 8 之后默认安装 Ceph 仓库源文件 /etc/apt/sources.list.d/ceph.list/etc/apt/sources.list.d/ceph.sources,可以使用如下命令更换源:

if [ -f /etc/apt/sources.list.d/ceph.list ]; then
  CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
  source /etc/os-release
  echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME $VERSION_CODENAME no-subscription" > /etc/apt/sources.list.d/ceph.list
fi
if [ -f /etc/apt/sources.list.d/ceph.sources ]; then
  CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
  source /etc/os-release
  cat > /etc/apt/sources.list.d/ceph.sources <<EOF
Types: deb
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME
Suites: $VERSION_CODENAME
Components: no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF
fi

更改完 sources.list 或 DEB822 仓库描述文件后请运行 apt update 更新索引以生效。

CT Templates

另外,如果你需要使用 Proxmox 网页端或 pveam 命令下载 CT Templates,可以替换 CT Templates 的源为 http://mirrors.ustc.edu.cn

具体方法:将 /usr/share/perl5/PVE/APLInfo.pm 文件中默认的源地址 http://download.proxmox.com 替换为 https://mirrors.ustc.edu.cn/proxmox 即可。

可以使用如下命令:

sed -i.bak 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm

针对 /usr/share/perl5/PVE/APLInfo.pm 文件的修改,执行 systemctl restart pvedaemon 后生效。

Note

/usr/share/perl5/PVE/APLInfo.pm 文件属于 pve-manager 软件包,该软件包升级后,需要重新替换 URL。