Proxmox VE 8.4 日常维护

更新日期:25-04-13
随着Proxmox 8.4版本发布,更新了基础系统中的部分内容,随之进行调整

01.修改源等

国内设置建议:设置更新源为国内华为源(目前debian国内最全的),删除付费企业源,添加清华开源订阅

设置 debian 华为源 - For PVE 8.x

cat > /etc/apt/sources.list <<EOF
deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
EOF

删除企业源 - For PVE 8.x

rm -rf /etc/apt/sources.list.d/pve-enterprise.list

添加下载秘钥 - For PVE 8.x下载密钥

wget http://mirrors.ustc.edu.cn/proxmox/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg

添加国内开源订阅 - For PVE 8.x

echo "deb http://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph.list

Proxmox软件源更换(可选)

南大NJU源(选一个):

echo "deb https://mirrors.nju.edu.cn/proxmox/debian bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
apt update && apt dist-upgrade

中科大源(选一个):

echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
apt update && apt dist-upgrade

其他可选源:(可选)

清华Tuna源

echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list

Debian系统源更换(可选)

阿里Debian源(选一个):

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
apt update && apt-get install -y apt-transport-https ca-certificates  --fix-missing

华为Debian源(选一个):

sed -i.bak "s#http://ftp.debian.org#https://repo.huaweicloud.com#g" /etc/apt/sources.lis
sed -i "s#http://security.debian.org#https://repo.huaweicloud.com/debian-security#g" /etc/apt/sources.list
apt update && apt-get install -y apt-transport-https ca-certificates  --fix-missing

163-Debian源(选一个):

sed -i.bak "s#ftp.debian.org/debian#mirrors.163.com/debian#g" /etc/apt/sources.list
sed -i "s#security.debian.org#mirrors.163.com/debian-security#g" /etc/apt/sources.list
apt update && apt-get install -y apt-transport-https ca-certificates  --fix-missing

LXC仓库源更换

南大NJU源(选一个):

sed -i.bak "s#http://download.proxmox.com/images#https://mirrors.nju.edu.cn/proxmox/images#g" /usr/share/perl5/PVE/APLInfo.pm  
wget -O /var/lib/pve-manager/apl-info/mirrors.nju.edu.cn https://mirrors.nju.edu.cn/proxmox/images/aplinfo-pve-7.dat
systemctl restart pvedaemon

中科大源(选一个):

sed -i.bak "s#http://download.proxmox.com/images#https://mirrors.ustc.edu.cn/proxmox/images#g" /usr/share/perl5/PVE/APLInfo.pm  
wget -O /var/lib/pve-manager/apl-info/mirrors.ustc.edu.cn https://mirrors.ustc.edu.cn/proxmox/images/aplinfo-pve-7.dat
systemctl restart pvedaemon

CEPH源更换

echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /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 -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

执行完成后,浏览器Ctrl+F5强制刷新缓存

02.系统更新

日常软件更新命令:

apt update -y && apt dist-upgrade -y

更新PVE,并安装常用软件

apt-get update && apt-get install vim lrzsz unzip net-tools curl screen uuid-runtime git -y && apt dist-upgrade -y

确认无误后,重新启动服务器

reboot

移除未使用的Linux内核

若不存在pvekclean,请先安装

git clone https://github.com/jordanhillis/pvekclean.git
cd pvekclean
chmod +x pvekclean.sh

安装完成后执行pvekclean即可

./pvekclean.sh

使用Pvetools配置设备(显卡、网卡等)直通等

export LC_ALL=en_US.UTF-8
apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git
cd pvetools
./pvetools.sh

一般配置项目如下图

pve_tools.jpg

最后再来个定期维护升级

apt update && apt -y --auto-remove --purge full-upgrade && apt -y --purge autoremove && apt clean -y