由于自带的软件源速度较慢,此处选择清华大学镜像源:https://mirrors.tuna.tsinghua.edu.cn
涉及的软件源有三个,分别为debain、pve、ceph,需要分别修改下列文件。
cp /etc/apt/sources.list /etc/apt/sources.list.bak
mkdir -p /root/sources_backup && cp /etc/apt/sources.list.d/* /root/sources_backup/
# 检查 PVE 版本
pveversion
cat > /etc/apt/sources.list << EOF
# 基础源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
# 更新源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
# 安全更新源
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
EOF
cat > /etc/apt/sources.list << EOF
# 基础源
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free
# deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free
# 更新源
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free
# deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free
# 安全更新源
deb https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free
# deb-src https://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free
EOF
# 备份原企业源
mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak 2>/dev/null
# 清华大学镜像站
echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
# 或中国科学技术大学镜像站
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
# 备份原Ceph源
mv /etc/apt/sources.list.d/ceph.list /etc/apt/sources.list.d/ceph.list.bak 2>/dev/null
# 清华大学镜像站(Ceph Quincy 版本)
echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
# 或中国科学技术大学镜像站
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
# 导入 Proxmox VE 官方密钥
wget -qO - https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg | gpg --dearmor | tee /usr/share/keyrings/proxmox-ve.gpg >/dev/null
# 导入 Ceph 官方密钥(可选,此步骤仅当您使用 Ceph 集群时才需要执行)
wget -q -O- 'https://download.ceph.com/keys/release.asc' | gpg --dearmor | tee /usr/share/keyrings/ceph-archive-keyring.gpg >/dev/null
sed -i "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy.service
# 安装 chrony(如果未安装)
apt install chrony -y
# 重启服务触发时间同步
systemctl restart chrony
# 验证时间同步状态
chronyc sources
# 更新软件包列表
apt update
# 执行系统升级(小版本升级)
apt dist-upgrade -y
# 执行系统更新
apt update && apt full-upgrade
# 清理缓存
apt autoremove && apt clean
# 检查 PVE 版本
pveversion
# 检查 Ceph 状态(仅集群环境需要)
ceph -s
Public key is not available
)当您运行 apt update
时遇到类似 GPG error: The following signatures couldn't be verified because the public key is not available
的错误时,通常是密钥没有正确导入。
解决方法: 重新执行 第三部分 中对应的 GPG 密钥导入命令。
# 重新导入 Proxmox VE 官方密钥
echo " 正在重新导入 Proxmox VE GPG 密钥..."
wget -qO - https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg | gpg --dearmor | tee /usr/share/keyrings/proxmox-ve.gpg >/dev/null
echo " Proxmox VE GPG 密钥重新导入完成。"
# 如果您使用 Ceph,也重新导入 Ceph 官方密钥
echo " 正在重新导入 Ceph GPG 密钥 (如果使用 Ceph)..."
wget -q -O- 'https://download.ceph.com/keys/release.asc' | gpg --dearmor | tee /usr/share/keyrings/ceph-archive-keyring.gpg >/dev/null
echo " Ceph GPG 密钥重新导入完成。"
# 重新运行更新
apt update
有时更新后 Web 界面可能出现异常,尝试重启相关的 PVE 服务:
systemctl restart pvedaemon.service pveproxy.service
echo "✅ PVE 相关服务已重启,请刷新 Web 界面。"
如果您在集群环境中执行 ceph -s
时提示命令不存在,说明 Ceph 客户端工具未安装。
apt install ceph-common -y
echo "✅ Ceph 客户端工具 (ceph-common) 已安装。"
bookworm
,其他节点也必须是 bookworm
)。