适用于Proxmox VE 7.x更换源,SSH登录到pve后台,然后执行命令。

一.处理掉企业源:

1.设置 debian 中科大源 - For PVE 7.x

1
2
3
4
5
6
7
8
9
10
cat > /etc/apt/sources.list <<EOF
deb http://mirrors.ustc.edu.cn/debian/ bullseye main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ bullseye-updates main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ bullseye main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-backports main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main non-free contrib
EOF

2.删除企业源 - For PVE 7.x

1
2
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

3.下载秘钥 - For PVE 7.x

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

4.添加国内源 - For PVE 7.x

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

5.修改自带的CEPH源 - For PVE 7.x

1
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-pacific bullseye main" > /etc/apt/sources.list.d/ceph.list

6.更新 - For PVE 7.x

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

二.更换内核版本

2.1官方内核

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#查看已安装内核
dpkg --get-selections |grep kernel

# 查询线上最新内核
apt search pve-kernel|grep pve-kernel-

# 安装内核
apt install pve-kernel-6.2.9-1-pve
apt install pve-headers-6.2.9-1-pve

#查看当前内核
uname -a

#查找内核
apt-cache search linux | grep 'PVE Kernel Image'

#安装内核
apt-get install pve-kernel-5.19.9-edge

#查看当前系统内核启动顺序
grep menuentry /boot/grub/grub.cfg

#修改内核启动顺序
nano /etc/default/grub

#把默认的GRUB_DEFAULT=“0”改为
GRUB_DEFAULT="Advanced options for Proxmox VE GNU/Linux>Proxmox VE GNU/Linux, with Linux 5.19.9-edge"

#更新引导并重启
update-grub
reboot

2.2添加高版本内核源

1
2
3
4
5
#Add the repository's GPG key:
curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | gpg --dearmor -o /usr/share/keyrings/pve-edge-kernel.gpg

#Set up the pve-edge-kernel repository:
echo "deb [signed-by=/usr/share/keyrings/pve-edge-kernel.gpg] https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" > /etc/apt/sources.list.d/pve-edge-kernel.list

三.删除未使用内核

1
2
3
4
5
#删除所有不必要的包
apt-get --purge autoremove

#删除指定内核
apt-get --purge remove pve-kernel-5.13.19-2-pve