加载中...

Pve7.2-x升级与优化教程


准备环境


1.准备网络环境,将域名proxmox.com添加到强制代理名单里

设置DNS


2.若安装时未设置DNS,请先设置DNS(如已设置过请忽略此步骤)

echo "nameserver  223.5.5.5" >> /etc/resolv.conf

echo "nameserver  114.114.114.114" >> /etc/resolv.conf

删除企业源和中文社区源


3.删除企业源和中文社区源

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

添加中文社区源


4.添加中文社区源

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

修改为国内源


5.修改为国内源(选其一即可)

  • 阿里云源

    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 https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription
    EOF
  • 腾讯云源

    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 https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription
    EOF

升级到最新内核


6.升级到最新内核

apt-get update

查看当前内核版本信息

uname -r
5.11.22-1-pve

以下分两种情况:
(1)不安装新内核,只安装当前内核头文件

apt-get install linux-headers-$(uname -r)

(2)安装新内核
查找内核

apt-cache search linux | grep 'PVE Kernel Image'

pve-kernel-5.11.17-1-pve - The Proxmox PVE Kernel Image
pve-kernel-5.11.21-1-pve - The Proxmox PVE Kernel Image
pve-kernel-5.11.22-2-pve - The Proxmox PVE Kernel Image
pve-kernel-5.11.7-1-pve - The Proxmox PVE Kernel Image
pve-kernel-5.4.119-1-pve - The Proxmox PVE Kernel Image
pve-kernel-5.4.124-1-pve - The Proxmox PVE Kernel Image
pve-kernel-5.4.128-1-pve - The Proxmox PVE Kernel Image

执行安装新内核

apt-get install pve-kernel-5.4.128-1-pve

最新内核安装完成后重启一下,才能删除旧内核

reboot

PS:因为在PVE下创建虚拟机 Realtek RTL8125 2.5GbE 的网卡 与1G的交换机连接 无法跑满速(只有大概20 ~ 40Mb/s),为降内核版本了安装 realtek-r8125-dkms_9.005.06-1_amd64.deb 驱动进行测试

实际上据说也是驱动bug,新的r8169驱动也支持这个网卡并且修复了这个bug,但是实际上测试并没有……

解决办法:
Chipset -> South Cluster Configuration -> PIC Express Configuration -> PCI Express Root Port

将全部PCI Express Root Port 的 ASPM 的Auto改成Disable

移除 Proxmox VE 旧版内核


7.移除 Proxmox VE 旧版内核
a) 安装 pvekclean

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

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

更换r8169驱动为r8125驱动


8.更换r8169驱动为r8125驱动
安装前请参考换源教程,将内核升级至5.15以上,建议将系统升级至最新(重要,必做)
若你主板有螃蟹8111网卡,请勿操作。

安装 dkms 和 pve-headers

apt-get install dkms pve-headers

安装ethtool工具

apt install ethtool -y

在线安装命令,驱动包持续更新,如果驱动有更新请修改对应文件名(和手动安装二选一)

wget https://github.com/awesometic/realtek-r8125-dkms/releases/download/9.009.01-1/realtek-r8125-dkms_9.009.01-1_amd64.deb
 
dpkg -i /root/realtek-r8125-dkms_9.009.01-1_amd64.deb

手动安装命令,如果没有网络环境下载不成功,请用手动安装(和在线安装二选一)
通过 WinSCP 等软件把驱动安装包上传至 PVE 的 /tmp 文件夹

dpkg -i --force-overwrite /tmp/realtek-r8125-dkms_9.009.01-1_amd64.deb

屏蔽系统自带的r8169驱动

echo 'blacklist r8169' >> /etc/modprobe.d/blacklist-r8169.conf

刷新和重启

update-initramfs -u -k all
reboot

查看刚才安装和屏蔽的驱动是否生效

ethtool -i enp2s0  #enp2s0是你的非直通网卡

提示结果如下,说明成功了

root@pve:~# ethtool -i enp2s0
driver: r8125
version: 9.009.01-NAPI
firmware-version: 
expansion-rom-version: 
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

#项目地址:https://github.com/awesometic/realtek-r8125-dkms

调整服务器时间


9.调整服务器时间(调整后PVE联网几分钟会自动更新时间)

nano /etc/systemd/timesyncd.conf

[Time]
NTP=ntp1.cn.ntp.org.cn ntp2.cn.pool.ntp.org 

移除 Proxmox VE 无有效订阅提示


10.移除 Proxmox VE 无有效订阅提示 (6.4-5、6、8、9 、13;7.0-9、10、11、13、14、14-1;7.1-5、6、8、10、11、12;7.2-3、4已测试通过)

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

文章作者: Vinjess
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Vinjess !
评论
  目录