独服 Debian 安装 PVE 教程

修改hosts文件

对hosts文件进行如下修改,

nano /etc/hosts

改成如下内容

127.0.0.1  localhost
你的外网IP pve.proxmox.com pve

修改完hosts文件后,设置服务器hostname为我们刚刚填加的hostname

hostnamectl set-hostname pve.proxmox.com

检查:

配置好以后,使用命令hostname –ip-address测试一下,应该需要显示你的IP地址,也就是显示配置好的IP才对。

hostname --ip-address
192.168.3.10 # should return your IP address here

 

用国内的源:

替换源,安装Debian的时候,已经选择了一个国内源“清华大学”,所以不需要再配置了,注意把DVD这个屏蔽掉,已经没有DVD了。不屏蔽掉,会报错。

修改

nano /etc/apt/sources.list

全部删除内容,然后将以下源复制进去

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

或者

# deb cdrom:[Debian GNU/Linux 11.3.0 _Bullseye_ - Official amd64 DVD Binary-1 20220326-11:23]/ bullseye contrib main

#deb cdrom:[Debian GNU/Linux 11.3.0 _Bullseye_ - Official amd64 DVD Binary-1 20220326-11:23]/ bullseye contrib main

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main

deb http://security.debian.org/debian-security bullseye-security main contrib
deb-src http://security.debian.org/debian-security bullseye-security main contrib

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib

这个配置很重要,如果配置错误,会导致软件安装有问题。

安装 Proxmox VE

添加 Proxmox VE 资源:

echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list

添加 Proxmox VE 资源 key as root (or use sudo):

wget https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg 

更新资源和系统:

apt update && apt full-upgrade

安装 Proxmox VE 包

apt install proxmox-ve postfix open-iscsi

执行这条指令以后,应该会进入一个正常安装流程,不应该报错。

安装 Postfix

apt install proxmox-ve postfix ksm-control-daemon open-iscsi bridge-utils -y

选local only就行

System Mail Name默认就好

删除os-prober包

apt remove os-prober -y

然后重启电脑,访问https://IP:8006进入PVE后台管理页面,其账号密码即为服务器ssh登录的账号密码。注意采用https协议,否则进不去。

下一步,修改授权版本

cd /etc/apt/sources.list.d/

ls
nano pve-enterprise.list

注释掉这句

#deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise

优化内核参数

如果是海外的独立服务器,建议开启BBR来优化TCP传输,开启方法如下:

#修改内核配置
cat >>/etc/sysctl.conf << EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF
#使配置生效
sysctl -p

使用命令lsmod |grep bbr进行验证,当看到tcp_bbr字样,说明BBR开启成功。

Linux默认描述符为1024,为避免后期出现各种问题,建议修改ulimit描述符限制,修改方法如下:

echo 'fs.file-max = 65535' >> /etc/sysctl.conf
echo '* soft nofile 65535' >> /etc/security/limits.conf
echo '* hard nofile 65535' >> /etc/security/limits.conf
echo 'ulimit -SHn 65535' >> /etc/profile