下载烧录镜像

官方网站下载 Proxmox VE xx ISO Installer 镜像,然后通过 UltraISO 安装,

菜单写入硬盘映像raw格式选中你的U盘,烧录完成后,和你平常做系统一样,进入快捷启动菜单,找到你的 U 盘并启动它。(或者去 BIOS 设置你的 U 盘为第一启动选项)

安装

图形化安装页面,进入后安装提示安装。首先开机的页面上会有个Install Proxmox VE 选中它。之后里面的国家还有时区选中你对应的国家和时区。

注意的地方是在 IP 那里,填写一个你路由器没有被占用的 IP。例如我的路由器的 IP 是 192.168.1.1,那么我通过路由器连接网络的话就要写一个 IP 例如 192.168.1.66(该 IP 没有被其他设备占用)。后面要通过它进入网页。

配置网络的时候还需要配置一个域名,随便写,不影响。

安装完成之后会重启,然后会给你一个登录提示,上面有你网页控制的地址。例如 192.168.1.66:8006。一定要用https://192.168.1.66:8006访问。

  1. 网络
    它的工作模式是通过物理网卡走桥接模式到他自己的虚拟网卡上。第一次进入后插入网线发现无法上网,通过命令。

    #重启网卡
    systemctl restart networking
    #检查网络
    ping www.baidu.com
    
  2. 这是网上资料显示是 debian 上 vi 有 BUG,表现为无法使用方向键和 insert 模式等。我们可以通过安装 vim 来解决问题。

  3. 它自己带的管理包源有 IPv6 和慢等原因,无法升级和安装 vim,所以我更新了它的源。

    #删除企业源
    rm -rf /etc/apt/sources.list.d/pve-enterprise.list
    #添加非订阅源
    echo "deb <https://mirrors.ustc.edu.cn/proxmox/debian/pve/> buster pve-no-subscription " >/etc/apt/sources.list.d/pve-install-repo.list
    #添加ceph源
    echo "deb <https://mirrors.ustc.edu.cn/proxmox/debian/ceph-nautilus> buster main " >/etc/apt/sources.list.d/pve-ceph.list
    # 建议同时使用国内debian源
    vim /etc/apt/sources.list
    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb <https://mirrors.tuna.tsinghua.edu.cn/debian/> buster main contrib non-free
    

网络配置方案

进入到宿主机,也就是你安装 PVE 的机器上。找到 /etc/network/interfaces 这个文件。实际上这是 Linux 的网络设置教程里,虽然每个发行版的文件名可能不一样,但是逻辑是一样的。

正常你的文件里是有物理网卡名的,如果没有按下面方法查看:

您可以使用 ip addr 命令查看 Linux 系统中正在使用的网卡,包括物理网卡和虚拟网卡。如果想要查看 Linux 系统中全部的网卡,可以查看 /proc/net/dev 文件。

我这里提供了 2 套网络方案:

  1. 路由方案(会和宿主机共用 IP 段)

    auto lo
    
    iface lo inet loopback
    
    #iface enp2s0f2 inet manual
    
    auto enp2s0f2 // 物理网卡名,
    
    iface enp2s0f2 inet static // static 静态IP DHCP 自动分配
    
    address  192.168.1.2
    
    netmask  255.255.255.0
    
    gateway  192.168.1.1
    
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    
    post-up echo 1 > /proc/sys/net/ipv4/conf/enp2s0f2/proxy_arp
    
    auto vmbr0
    
    iface vmbr0 inet static
    
    address 100.168.1.2
    
    netmask 255.255.255.248
    
    bridge-ports none
    
    bridge-stp off
    
    bridge-fd 0
    
    iface wlp3s0 inet manual
    
  2. 同时配置 NAT 共享 IP 和独立 IP 虚拟机

    auto lo
    
    iface lo inet loopback
    
    llow-hotplug enp2s0f2 #物理网卡名称
    
    iface enp2s0f2 inet manual
    
    auto vmbr0
    
    iface vmbr0 inet static
    
    address 192.168.1.2 #pve宿主机器的IP
    
    netmask 255.255.255.248
    
    gateway 192.168.1.1
    
    bridge-ports enp2s0f2
    
    bridge-stp off
    
    bridge-fd 0
    
    auto vmbr1
    
    iface vmbr1 inet static
    
    address 192.168.10.1 #虚拟Ip
    
    netmask 255.255.255.0
    
    bridge_ports none
    
    bridge_stp off
    
    bridge_fd 0
    
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    
    post-up bash /root/iptables.config.sh
    
    post-up iptables -t nat -A POSTROUTING -s '192.168.10.0/24' -o vmbr0 -j MASQUERADE
    
    post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vmbr0 -j MASQUERADE