【温馨提醒】

❉大版本的系统更新会有更新失败的风险,更新前你要考虑清楚:能否承受更新失败带来的后果?以及更新系统后虚拟机能否顺利启动?

❉生产环境用机不建议升级更新!生产环境用机不建议升级更新!生产环境用机不建议升级更新!

❉根据PVE官网的【升级说明】,在升级到PVE8.0之前,需要先更新到PVE7.4-15。

❉在正式操作之前,必须把虚拟机全部关机,并取消所有虚拟机的“自动启动”设置。有重要数据的话强烈建议先备份!

【升级步骤】

  1. 修改/etc/vim/vimrc.tiny

    set nocompatible
    set backspace=2
    
  2. 依次输入以下命令(每次复制一行,到PVE的Shell里面粘贴,按回车执行),目的是替换源以及把PVE版本更新到7.4-15版本;

    rm -rf /etc/apt/sources.list.d/pve-install-repo.list
    echo "deb https://enterprise.proxmox.com/debian/pve Bullseye pve-enterprise" > /etc/apt/sources.list.d/pve-enterprise.list
    wget https://mirrors.ustc.edu.cn/proxmox/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg
    echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
    echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-pacific bullseye main" > /etc/apt/sources.list.d/ceph.list
    sed -i.bak "s#http://download.proxmox.com/debian#https://mirrors.ustc.edu.cn/proxmox/debian#g" /usr/share/perl5/PVE/CLI/pveceph.pm
    sed -i.bak "s#ftp.debian.org/debian#mirrors.aliyun.com/debian#g" /etc/apt/sources.list
    sed -i "s#security.debian.org#mirrors.aliyun.com/debian-security#g" /etc/apt/sources.list
    echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" >> /etc/apt/sources.list
    
  3. 修改/etc/apt/sources.list

    deb https://mirrors.aliyun.com/debian bullseye main co://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    
    deb http://mirrors.aliyun.com/debian bullseye-updates main contrib
    
    # security updates
    deb http://mirrors.aliyun.com/debian-security bullseye-security main contrib
    deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
    deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
    
    # 添加清华源
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    
  4. 编辑pve企业源:

    mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak
    # 在末尾添加免费的存储库
    echo "deb http://security.debian.org/debian-security bullseye-security main contrib" >> /etc/apt/sources.list
    echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription" >> /etc/apt/sources.list.d/pve-enterprise.list
    
  5. 执行更新

    apt update && apt dist-upgrade -y
    
  6. 更新中,耐心等待;

  7. 当命令全部运行结束后,会回到“root@pve:~#”这样的命令行状态,点PVE菜单上的重启键,重启一次;

  8. 重启完成再进入到Shell状态下,此时可以看到系统版本已经变成7.4-15了;

  9. 输入命令pve7to8回车,检查一下是否符合升级要求;

  10. 还好只有一个警告项,然后FAILUSER这一项的数字为0,证明可以升级;

= SUMMARY =

TOTAL:    29
PASSED:   23
SKIPPED:  5
WARNINGS: 1
FAILUSER: 0

ATTENTION: Please check the output for detailed information!
  1. 复制下面三行命令到PVE的Shell里面粘贴,按回车执行;
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
echo "deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise" > /etc/apt/sources.list.d/pve-enterprise.list
echo "deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph.list
  1. 输入apt update回车;

  2. 如果出现“Failed to fetch ******** 401 Unauthorized”这个错误;

  3. 复制下面命令到PVE的Shell里面粘贴,按回车执行;

    echo "#deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise" > /etc/apt/sources.list.d/pve-enterprise.list
    
  4. 再次输入命令apt update回车,这次就不会报错了;

  5. 输入命令apt dist-upgrade -y回车,开始升级PVE8.0;

  6. 升级过程中会弹出这些界面,需要我们手动确认,无需选择,全部直接按回车就行了;

  7. 当命令全部运行结束后,会回到root@pve:~#这样的命令行状态,这样就更新成功了;

  8. 不需要重启,直接把电脑浏览器关掉,重新登录进入PVE,会看到版本已经变成8.0.3了;

  9. 在Shell状态下输入apt autoremove -y回车,并输入y回车,自动清理本次升级更新产生的临时文件;

  10. 至此,升级工作全部完成!

参考文档