PVE初次配置

PVE初次配置

刚安装的新鲜PVE,都需要进行一番配置

磁盘挂载

添加系统挂载

先挂载一块硬盘,以便还原一些数据
首先通过 ls /dev/disk/by-id/ 查看想要挂载的磁盘id
一定不要使用/dev/sdx或者/dev/nvmexxx这种方式,就算是虚拟机环境下,磁盘也会窜来窜去导致无法挂载
下一步就是nano /etc/fstab,写入挂载信息了,为什么不用 vim?因为刚装的PVE没有
我的是 /dev/disk/by-id/nvme-GLOWAY_YCT2TNVMe-M.2_80_M23041112171-part1 /mnt/gw2t ext4 defaults,nofail 0 1 添加到行尾即可
其中比较重要的是nofail,加了这个参数可以保证磁盘出问题也可以开机
后续进行systemctl daemon-reload mount -a 验证挂载效果,记得新建挂载的文件夹。。

添加到PVE存储

然后去数据中心存储里添加一个目录类型的,ID随便,文件夹就填自己挂载的,内容全选上

换源

删除系统自带的所有源
rm /etc/apt/sources.list.d/*
然后
nano /etc/apt/sources.list
写入以下内容

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main non-free contrib

#PVE
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm  pve-no-subscription
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm  main

安装点小软件

安装前可能DNS不通,先通过PVE面板把DNS设置为223.5.5.5再进行
apt update
apt upgrade -y
请注意:upgrade可能会导致多网卡机器网卡对换,upgrade后不要重启,后面会说怎么修正
安装一些PVE必备的玩意 apt install vim libgl1 libegl1 安装一些我平常用的 apt install htop glances net-tools iotop

配置IOMMU

nano /etc/default/grub 更改GRUB_CMDLINE_LINUX_DEFAULT,在quiet后写入intel_iommu=on iommu=pt
然后 nano /etc/modules
添加

1
2
3
4
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

跑一下update-initramfs -u -k allupdate-grub
重启即可配置完成

开启IPV6

nano /etc/sysctl.conf

1
2
3
4
5
6
net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.default.accept_ra=2
net.ipv6.conf.vmbr0.accept_ra=2
net.ipv6.conf.all.autoconf=1
net.ipv6.conf.default.autoconf=1
net.ipv6.conf.vmbr0.autoconf=1

绑定喜欢跳来跳去的网卡

nano /etc/systemd/network/90-eno0.link

1
2
3
4
[Match]
MACAddress=00:e0:1f:6d:0e:ba
[Link]
Name=eno0

nano /etc/systemd/network/91-eno1.link

1
2
3
4
[Match]
MACAddress=00:e0:4c:76:cd:b4
[Link]
Name=eno1

注意:一定不要叫ethx,会冲突,导致莫名其妙的交换
然后去改掉PVE的
nano /etc/network/interfaces 删掉那些eno enp开头的奇怪的网卡相关的配置,然后添加

1
2
iface eno0 inet manual
iface eno1 inet manual

给vmbr0的关联网卡改掉

1
bridge-ports eno0

基本上搞定了,可以enjoy了

Licensed under CC BY-NC-SA 4.0
使用 Hugo 构建
主题 StackJimmy 设计