侧边栏壁纸
  • 累计撰写 2 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

PVE 8.0更换国内源

Abner
2023-07-20 / 0 评论 / 2 点赞 / 306 阅读 / 2299 字

1.您可以使用文本编辑器创建一个新的脚本文件,例如 update_proxmox.sh,然后将所有命令按照顺序粘贴到该脚本文件中,并保存。

      nano update_proxmox.sh
#!/bin/bash
# 备份 sources.list
mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 编辑 sources.list
cat << EOF > /etc/apt/sources.list
deb https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main non-free non-free-firmware contrib
EOF
# 编辑 pve-no-subscription.list
cat << EOF > /etc/apt/sources.list.d/pve-no-subscription.list
deb https://mirrors.ustc.edu.cn/proxmox/debian bookworm pve-no-subscription
# deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription
EOF
# 编辑 ceph.list
cat << EOF > /etc/apt/sources.list.d/ceph.list
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
# deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise
EOF
# 注释掉 pve-enterprise.list
cat << EOF > /etc/apt/sources.list.d/pve-enterprise.list
#deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise
EOF
# 更新源
apt update
# 更新 LXC(CT Template)源
cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm_back
sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
systemctl restart pvedaemon.service
# 更新 PVE 到最新发行版本
apt dist-upgrade

2.保存脚本后,您需要为其添加执行权限,可以使用以下命令:

 chmod +x update_proxmox.sh

3.然后,您可以通过以下命令来运行脚本:

 ./update_proxmox.sh

请注意,在运行脚本之前,仍然建议您先备份系统或创建系统快照,以防止意外问题。

2

评论区