pvetools 工具脚本一键方式

教程pvetools: https://github.com/ivanhao/pvetools

方式一:命令行安装
需要用root账号来运行

在终端中按行分别执行以下内容:

强烈建议先删除企业源:rm /etc/apt/sources.list.d/pve-enterprise.list
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

这是一个为proxmox ve写的工具脚本(理论上debian9+可以用)。包括配置邮件sambaNFSzfs嵌套虚拟化docker硬盘直通等功能。

支持的功能

  1. 配置apt源(更换为ustc.edu.cn,去除企业源等)
  2. 安装配置samba
  3. 安装配置root邮件通知
  4. 安装配置zfs最大内存及zed通知
  5. 安装配置VIM
  6. 安装配置CPU省电
  7. 安装配置硬盘休眠
  8. 配置PCI硬件直通
  9. 配置pve的web界面显示传感器温度
  10. 配置开启嵌套虚拟化
  11. 去除订阅提示
  12. 升级该pvetools脚本到最新版


手动方式

①删除企业源和中文社区源
rm -rf /etc/apt/sources.list.d/pve-enterprise.list
rm -rf /etc/apt/sources.list.d/pve-install-repo.list

②下载秘钥(最好挂梯子执行,有些梯子还需要把proxmox.com添加到代理名单)

适用于 PVE 7.x

wget https://mirrors.ustc.edu.cn/proxmox/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg ##适用于 PVE 7.x

wget http://download.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg ##适用于 PVE 7.x

适用于 PVE 6.x

wget https://mirrors.ustc.edu.cn/proxmox/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg ##适用于 PVE 6.x
wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg ##适用于 PVE 6.x

③添加中文社区源

添加社区源(proxmox6)---不要设置

echo "deb http://download.proxmox.wiki/debian/pve buster pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list
echo "deb http://download.proxmox.wiki/debian/ceph-octopus buster main" > /etc/apt/sources.list.d/ceph.list

添加社区源(proxmox7)---不要设置

echo "deb http://download.proxmox.wiki/debian/pve bullseye pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list
echo "deb http://download.proxmox.wiki/debian/ceph-octopus bullseye main" > /etc/apt/sources.list.d/ceph.list
中文社区源抽风的时候,改回Proxmox官方源(推荐)
echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" >/etc/apt/sources.list.d/pve-install-repo.list

适用于 PVE 7.x

④修改为proxmox7 - 阿里云源
cat >/etc/apt/sources.list<<'EOF'
deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb https://mirrors.aliyun.com/debian-security bullseye-security main contrib non-free
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.aliyun.com/debian-security bullseye-security main contrib non-free
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
EOF
或者,修改为proxmox7 - 腾讯云源
cat >/etc/apt/sources.list<<'EOF'
deb https://mirrors.cloud.tencent.com/debian/ bullseye main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ bullseye-updates main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ bullseye-backports main contrib non-free
deb https://mirrors.cloud.tencent.com/debian-security bullseye-security main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian-security bullseye-security main contrib non-free
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
EOF

适用于 PVE 6.x

④修改为proxmox6 - 阿里云源
cat >/etc/apt/sources.list<<'EOF'
deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb http://download.proxmox.com/debian/pve buster pve-no-subscription
EOF
或者,修改为proxmox6 - 腾讯云源
cat >/etc/apt/sources.list<<'EOF'
deb https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
deb http://download.proxmox.com/debian/pve buster pve-no-subscription
EOF

⑤运行 apt-get update && apt-get upgrade && apt-get dist-upgrade -y 升级到最新系统和内核(最好挂梯子执行,有些梯子还需要把proxmox.com添加到代理名单)
注:
a) 如果只是升级系统,接下来绕过⑥⑦步,重启系统后执行第⑧步去除无效订阅提示、执行第⑨步移除旧版内核;
b) ①~④步骤做过一次后,将来无论是升级系统还是安装驱动,一般不需要重复这些步骤,而是直接从第⑤步开始即可;

⑥安装 dkms 和 pve-headers
apt-get install dkms pve-headers

⑦通过 WinSCP 等 SFTP 软件把驱动安装包上传至 PVE 的 /tmp 文件夹;如果首次安装 RTL8125驱动,执行以下命令安装
dpkg -i --force-overwrite /tmp/realtek-r8125-dkms_9.005.06-1_amd64.deb(此处文件名请根据实际自行更改);
如果是升级安装 RTL8125驱动,执行以下命令升级安装
dpkg -i /tmp/realtek-r8125-dkms_9.005.06-1_amd64.deb(此处文件名请根据实际自行更改);

⑧移除 Proxmox VE 无有效订阅提示 (6.3-6 ~ 6.4-6已测试通过)
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

⑨移除 Proxmox VE 旧版内核
a) 安装 pvekclean
echo "nameserver 223.5.5.5" >> /etc/resolv.conf && export LC_ALL=en_US.UTF-8 && apt update && apt -y install git && rm -rf ./pvekclean/ && git clone https://hub.fastgit.org/jordanhillis/pvekclean.git && cd pvekclean && chmod +x pvekclean.sh && ./pvekclean.sh

echo "nameserver 114.114.114.114" >> /etc/resolv.conf && export LC_ALL=en_US.UTF-8 && apt update && apt -y install git && rm -rf ./pvekclean/ && git clone https://github.com/jordanhillis/pvekclean.git && cd pvekclean && chmod +x pvekclean.sh && ./pvekclean.sh

b) 运行 pvekclean
pvekclean -f

注意事项:
①根据 PVE 的版本选择合适的文件夹脚本;
①如果你的 PVE 不在压缩包的版本之内,请先更新系统至相同版本。千万不要强行替换,否则后果自负。

操作方法:
①WinSCP等SFTP功能软件访问PVE,按照功能需求,复制文件到对应路径;
② SSH 访问 PVE,执行以下命令;
a) 如果是全新安装,需要安装工具并重启 pveproxy 服务:
apt-get install lm-sensors && apt-get install nvme-cli && apt-get install hddtemp && chmod +s /usr/sbin/nvme && chmod +s /usr/sbin/hddtemp && chmod +s /usr/sbin/smartctl && systemctl restart pveproxy
b) 如果是更新脚本,只需要重启 pveproxy 服务:
systemctl restart pveproxy
③Chrome 或 Edge 浏览器,Shift+F5清除缓存并刷新网页;

注:移除 Proxmox VE 无有效订阅提示 (6.4-5、6、8、9 、13;7.0-9、7.0-10已测试通过)
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

相关下载

https://nzh.lanzouq.com/b06tjhtyf
密码:gdkp

Last modification:January 3rd, 2022 at 12:11 pm
如果觉得我的文章对你有用,请随意赞赏