<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="Debian安装Proxmox VE">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">admin</a><br />时间:2024-10-18 15:49<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">电脑技术</a><br />内容:
Debian安装Proxmox VE


Proxmox VE基于Debian，因此可以从Debian系统安装Proxmox VE。相关教程如下：


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_12_Bookworm //Promxox 8


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_11_Bullseye   // Promxox 7


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster           // Promxox 6


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Stretch          // Promxox 5


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Jessie            // Promxox 4


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Wheezy         // Promxox 3


https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Squeeze        // Promxox 2


本文以Debian12安装Proxmox VE 8为例，给大家讲解如何从Debian安装Proxmox VE。


一：环境准备


硬件：


XML/HTML代码


    CPU开启虚拟化

    开启VT-D（可选）

    有网络





软件：




XML/HTML代码


    Debian12发行版

    国内软件源







此教程请使用root用户身份运行，而不要使用sudo。如果你是sudo用户，请使用此命令切换到root。




XML/HTML代码


    sudo -i







如果没有配置root密码，请使用passwd root 修改root密码


二：配置debian源


需要将debian源换成国内源，否则会由于网络超时，无法安装软件包。


备份现在软件源




XML/HTML代码


    cp /etc/apt/sources.list sources.list.bak







修改软件源




XML/HTML代码


    nano /etc/apt/sources.list




并将下面内容填进去


清华源




XML/HTML代码


    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

    deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

    deb http://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription







中科大源




XML/HTML代码


    deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

    deb http://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

    deb http://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

    deb http://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware

    deb http://mirrors.ustc.edu.cn/proxmox/debian bookworm pve-no-subscription







最后按ctrl +x 保存。


可以执行下面命令验证




XML/HTML代码


    cat /etc/apt/sources.list







安装一些工具




XML/HTML代码


    apt update &amp;&amp; apt install -y apt-transport-https wget





常用软件




XML/HTML代码


    apt-get -y install htop nload ncdu wget curl tar gzip bzip2 xz-utils unzip net-tools sudo ca-certificates






安装gpg秘钥




XML/HTML代码


    wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg 







三：安装SSH




XML/HTML代码


    apt update &amp;&amp; apt install -y openssh-server




安装ssh之后，需要启用密码登录和root访问。




XML/HTML代码


    sed -i &quot;s/PermitRootLogin.*/PermitRootLogin yes/g&quot; /etc/ssh/sshd_config

    sed -i &quot;s/#PermitRootLogin.*/PermitRootLogin yes/g&quot; /etc/ssh/sshd_config

    sed -i &quot;s/PasswordAuthentication.*/PasswordAuthentication yes/g&quot; /etc/ssh/sshd_config

    systemctl restart ssh || service ssh restart







一般情况，Debian系统安装后默认就有ssh服务并且可以root登录，如果没有ssh或者不能root登录，用上面命令安装配置。 


四：配置静态ip


由于某些debian使用的是nmcli，还需要停用NetworkManager服务




XML/HTML代码


    systemctl disable NetworkManager &amp;&amp; systemctl stop NetworkManager




删除其他的文件




XML/HTML代码


    rm /etc/network/interfaces.d/*




编辑网卡配置文件




XML/HTML代码


    nano  /etc/network/interfaces




添加如下参数




XML/HTML代码


    auto enp6s18

    iface enp6s18 inet static

          address 10.13.14.112/24

          gateway 10.13.14.254




请将enp6s18换成自己的网卡。把ip换成自己的ip(可以通过命令ip a 查看自己的网卡名)


配置dns




XML/HTML代码


    echo &quot;nameserver 223.5.5.5&quot; &gt;&gt;/etc/resolv.conf




重启网络服务




XML/HTML代码


    systemctl restart networking







安装ifupdown2




XML/HTML代码


    apt update &amp;&amp; apt install -y ifupdown2




 五：配置host


pve服务需要host文件正确，否则会出现无法启动的问题。




XML/HTML代码


    #查看本机 hostname

    cat /etc/hostname







修改本机host配置（假如上面命令查看到hostname是debian）




XML/HTML代码


    vi /etc/host




我们将# The following lines are desirable for IPv6 capable hosts 这上面的部分改成如下：




XML/HTML代码


    127.0.0.1 localhost.localdomain localhost

    10.13.14.112 debian.pvetest.com debian







10.13.14.112 debian.pvetest.com debian 这段结构是ip  fqdn  hostname


fqdn就是域名全称。例如www.baidu.com ，www则代表主机名，baidu.com是域名，fqdn是www.baidu.com ，fqdn可以自己取，如果你不懂，你就按照我这个来填。但是你必须将debian换成自己的hostname。这个hostname将作为PVE的节点名称。将ip换成自己的ip，这个ip是dhcp的也没关系。


五：安装Proxmox VE


使用正确的path




XML/HTML代码


    export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin




安装Proxmox VE




XML/HTML代码


    #更新系统

    apt update &amp;&amp; apt full-upgrade

    #安装PVE内核

    apt -y install proxmox-default-kernel

    systemctl reboot









XML/HTML代码


    apt install -y proxmox-ve postfix open-iscsi chrony







无交互，无推荐包安装方式




XML/HTML代码


    DEBIAN_FRONTEND=noninteractiv apt-get --no-install-recommends install -y proxmox-ve







等会会出现一个弹窗，选择 No configuration ,确认后继续安装，然后等待安装结束之后，就可以访问pve


https://ip:8006 登录账号密码就是root用户账号密码。


删除无用内核




XML/HTML代码


    apt remove linux-image-amd64 'linux-image-6.1*'

    update-grub







删除os-prober




XML/HTML代码


    apt remove os-prober







参考：https://foxi.buduanwang.vip/virtualization/pve/1868.html


参考：https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_12_Bookworm


安装比较简单，注意hosts设置一定要和hostname一致，也就是ip和主机名对应那一行，其他无所谓。主机支持虚拟化技术就可以使用PVE创建kvm虚拟机，如果不支持也可以用来管理LXC容器，比较方便。




PVE ON ARM 


Proxmox-Port：https://github.com/jiangcuo/Proxmox-Port


系统下载：https://mirrors.apqa.cn/proxmox/isos/


支持设备：https://github.com/jiangcuo/Proxmox-Port/wiki/Support-List




XML/HTML代码


    Rockpi (arm64)

    Raspberry Pi (arm64)

    Amlogic TV box (arm64)

    Kunpeng (arm64)

    FT (arm64)

    Ampere (arm64)

    Apple (arm64,vm only,no kvm support)

    3A5000/3A6000/3C5000 (loongarch64)

    VisionFive2 (riscv64)







快速入门


1.下载port gpg key




XML/HTML代码


    curl -L https://mirrors.apqa.cn/proxmox/debian/pveport.gpg -o /etc/apt/trusted.gpg.d/pveport.gpg




2. 将地址添加到 sources.list




XML/HTML代码


    echo &quot;deb https://mirrors.apqa.cn/proxmox/debian/pve bullseye port&quot;&gt;/etc/apt/sources.list.d/pveport.list




3. 执行 apt update




XML/HTML代码


    apt update





安装教程同x86，和上面完全一样，无非就是源不一样。

CDN 镜像


它们是来自mirrors.apqa.cn的rsync




XML/HTML代码


    Korea: https://mirrors.apqa.cn

    Hong Kong: https://hk.mirrors.apqa.cn

    China: https://mirrors.lierfang.com

    Germany: https://de.mirrors.apqa.cn







安装教程：https://foxi.buduanwang.vip/virtualization/pve/1902.html


参考：https://itca.cc/ProxmoxVE%E8%99%9A%E6%8B%9F%E5%8C%96/118.html


注意：以上设备安装后支持KVM+LXC 和 x86 机器安装后完全一样，如果是盒子之类的设备，内核不支持KVM虚拟化，安装后不能开KVM虚拟机，只能使用LXC功能，相当于是带web管理的LXC服务器，适合小白使用，不需要复杂的命令。


特别注意：安装PVE前尽量先设置hostname一般设置为pve  hosts必须添加本地ip和域名，例如：




XML/HTML代码


    192.168.0.100 pve.proxmox.com pve




如果安装后无法打开web管理，可以用下面命令查看并重启服务




XML/HTML代码


    service pvedaemon status

    service pveproxy status

    service pvestatd status




如果提示 /etc/pve/local/pve-ssl.key: failed to load 也就是证书不存在（hosts必须有本机IP，而不是127.0.0.1）




XML/HTML代码


    #查看hosts是否正常

    hostname --ip-addr

    #强制更新证书

    pvecm updatecerts --force




通过以上方法就可以解决PVE无法打开web管理的问题。


常用的Debian一键安装PVE脚本




Auto-Install Proxmox on Debian（推荐）


XML/HTML代码


    wget -qO - https://raw.githubusercontent.com/CubePathInc/autoinstall-proxmox-debian/main/setup.sh | bash

    #国内

    wget -qO - https://gh-proxy.com/https://raw.githubusercontent.com/CubePathInc/autoinstall-proxmox-debian/main/setup.sh | bash





Debian12一键安装PVE






XML/HTML代码


    curl -L -s -O https://github.com/rioastamal/proxmox-installer-sh/raw/refs/heads/main/proxmox-installer.sh

    #国内

    curl -L -s -O https://gh-proxy.com/https://github.com/rioastamal/proxmox-installer-sh/raw/refs/heads/main/proxmox-installer.sh









XML/HTML代码


    #一键安装

    wget -qO - https://github.com/BasToTheMax/ProxmoxDebian-Install/raw/refs/heads/main/install.sh | bash

    #禁用Ipv6

    wget -qO - https://github.com/BasToTheMax/ProxmoxDebian-Install/raw/refs/heads/main/disable-v6.sh | bash









XML/HTML代码


    #适合境外服务器

    wget -qO - https://github.com/edwincitox/debian12-proxmox8/blob/main/debian12-proxmox8.sh | bash




Debian系统一键安装PVE



Github：https://github.com/oneclickvirt/pve

说明文档：https://virt.spiritlhl.net/guide/dashboard.html

要求

系统要求：Debian 8+（建议debian12而不是debian11，debian11在部分独立服务器上有网络重启的BUG。）

硬件要求：2核2G内存x86_64或arm架构服务器硬盘至少20G

可开KVM的硬件要求：VM-X或AMD-V支持 (部分VPS和全部独服支持)

如果硬件或系统需求不满足，可使用incus批量开LXC容器

https://github.com/oneclickvirt/incus

开设虚拟内存(SWAP)(非必须的可选项)

单位换算：输入 1024 产生 1G SWAP-虚拟内存，虚拟内存占用硬盘空间，当实际内存不够用时将自动使用虚拟内存做内存使用，但随之带来IO高占用以及CPU性能占用。

建议只开实际内存大小两倍大小的虚拟内存。


XML/HTML代码


    #国际

    curl -L https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh &amp;&amp; chmod +x addswap.sh &amp;&amp; bash addswap.sh

    #国内

    curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/spiritLHLS/addswap/main/addswap.sh -o addswap.sh &amp;&amp; chmod +x addswap.sh &amp;&amp; bash addswap.sh




检测环境

本项目相关脚本执行前务必执行本脚本检测环境，如果不符合安装PVE的要求则无法使用后续的脚本

检测本机IPV6的网络配置情况(有无IPV6都可安装，只是查询一下罢了)

检测硬件配置是否满足最低要求

检测硬件环境是否可嵌套虚拟化KVM类型的服务器

检测系统环境是否可嵌套虚拟化KVM类型的服务器

不可嵌套虚拟化KVM类型的服务器也可以开LXC虚拟化的服务器，但不推荐安装PVE，不如使用incus


XML/HTML代码


    #国际

    bash &lt;(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/check_kernal.sh)

    #国内

    bash &lt;(wget -qO- --no-check-certificate https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/check_kernal.sh) 




如果你需要更新IPV6信息再查询，那么执行以下命令后再查询


XML/HTML代码


    rm -rf /usr/local/bin/pve_ipv6*

    rm -rf /usr/local/bin/pve_check_ipv6*

    rm -rf /usr/local/bin/pve_last_ipv6*




PVE主体安装

安装过程中遇到选项不会选的可无脑按回车，本项目所有脚本内置国内外IP自动判断，使用的是不同的安装源与配置文件，有使用CDN加速镜像下载

一键安装PVE

建议debian12，实测部分独立服务器的debian11系统会出现一重启网络就失联的情况，debian12没有这种问题

安装的是当下apt源最新的PVE

比如debian10则是pve6.4，debian11则是pve7.x，debian12则是pve8.x

/etc/hosts文件修改(修正商家hostname设置错误以及新增PVE所需的内容)

/etc/cloud/cloud.cfg文件修改(避免覆写已修改的hostname等配置)

/etc/network/interfaces文件修改(修复auto、dhcp类型为static、增加vmbr0网关)

检测是否为中国IP，如果为中国IP使用清华镜像源，否则使用官方源，同时处理apt的源和对应的nameserver，避免断网

创建vmbr0(独立IP网关)，宿主机允许addr和gateway为内网IP或外网IP，已自动识别

vmbr0创建支持开设纯IPV4、纯IPV6、双栈虚拟机，自动识别IPV4地址和IPV6地址，自动识别对应的IP区间

安装PVE开虚拟机需要的必备工具包

x86_64的替换apt源中的企业订阅为社区源，arm的使用第三方修复的补丁构建的源

打印查询Linux系统内核和PVE内核是否已安装

设置DNS检测8.8.8.8的开机自启添加DNS的systemd服务

新增PVE的APT源链接后，下载PVE并打印输出登陆信息

所有修改过的文件均已设置为只读模式，避免重启后文件被覆写

如需修改请使用chattr -i 文件路径取消只读锁定，修改完毕请执行chattr +i 文件路径进行只读锁定

执行过程中会提示重启系统一次，重启后务必等待起码20秒确保系统未再次自动重启

因为原始环境可能缺失ifupdown或ifupdown2环境，有加载自安装的守护进程进行安装，安装后会再次自动重启系统，等待20秒未自重启确保这个安装已运行完毕

若宿主机本身存在SLAAC分配的IPV6地址，将可选择是否使用最大的IPV6子网范围，默认回车不使用最大的IPV6子网范围仅使用本机IPV6，若后续需要给虚拟机/容器附加独立的IPV6地址，该选项务必选择y.


XML/HTML代码


    #国际

    curl -L https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/install_pve.sh -o install_pve.sh &amp;&amp; chmod +x install_pve.sh &amp;&amp; bash install_pve.sh

    #国内

    curl -L https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/install_pve.sh -o install_pve.sh &amp;&amp; chmod +x install_pve.sh &amp;&amp; bash install_pve.sh

    #或

    bash install_pve.sh




安装成功后打开网页可能提示不安全，点击高级或更多选项，坚持访问即可

登录的信息是你SSH的账户和密码

预配置环境

创建资源池mypool(local)

移除订阅弹窗

尝试开启硬件直通

对AppArmor模块检测和自动安装

重启系统前推荐挂上nezha探针方便在后台不通过SSH使用命令行，避免SSH可能因为商家奇葩的预设可能导致重启后root密码丢失

执行reboot前需要等待后台任务执行完毕，一些宿主机的系统apt命令执行很慢，得等一会才能执行完毕，当然大部分的机器没这么烂


XML/HTML代码


    #国际

    bash &lt;(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_backend.sh)

    #国内

    bash &lt;(wget -qO- --no-check-certificate https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_backend.sh)




自动配置宿主机的网关

使用前请保证重启过服务器且此时PVE能正常登录进WEB端再执行，重启机器后不要立即执行此命令，待WEB端启动并可登录成功后至少等1分钟再执行本命令。这一步是最容易造成SSH断开的，原因是未等待PVE内核启动就修改网络会造成设置冲突，所以至少等几分钟待内核启动也就是WEB端启动成功后再执行

在执行本命令前如果宿主机需要附加IPV6隧道的地址，请查看incus的自定义分区部分的内容附加到对应文件中，但请忽略它的初始环境修改部分的内容

如果vmbr0未创建，则自动创建，逻辑同主体安装一致

创建vmbr1(NAT网关)，支持开设NAT的IPV6网络的NAT的IPV4的服务器

创建vmbr2(独立IPV6网关)，使用ndppd解决宿主机对IPV6地址进行MAC校验的问题，支持开设带独立IPV6网络的服务器

想查看完整设置可以执行cat /etc/network/interfaces查看，如需修改网关需要修改该文件，web端已经无法修改

加载iptables并设置回源且允许NAT端口转发

简单的说，vmbr0负责v4的独立IP，vmbr1负责复杂v4/v6的NAT，vmbr2负责v6的独立IP

开独立IPV4的虚拟机时使用的vmbr0，gateway同宿主机，IPV4/CIDR使用同一网段的地址和相同的子网掩码，使用宿主机未绑定的IPV4地址做IPV4/CIDR，当然如果后续使用本套脚本无需关注这点细枝末节的东西

开NAT的IPV4的虚拟机时使用vmbr1，gateway使用172.16.1.1，IPV4/CIDR使用172.16.1.x/24，这里的x不能是1，当然如果后续使用本套脚本无需关注这点细枝末节的东西。


XML/HTML代码


    #国际

    bash &lt;(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_nat_network.sh)

    #国内

    bash &lt;(wget -qO- --no-check-certificate https://cdn.spiritlhl.net/https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_nat_network.sh)




这一步是可能需要你执行成功几分钟后重启系统，详见脚本最后执行完毕的提示，但重启可以保证部分隐藏设置加载成功，有条件务必重启一次服务器。




</p><p>
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
