pve制作自动安装镜像

官方文档Automated Installation - Proxmox VE

有时候有批量安装pve的需求,这个时候用pxe(比如iventoy)启动配合自动安装镜像就能完成批量部署安装pve

当然如果需要部署已经配置好的pve系统,建议用再生龙/企鹅龙实现硬盘克隆分发部署,但是这种只能客户机硬盘大于等于源机硬盘。

安装工具

apt install proxmox-auto-install-assistant

 

1.本地配置文件方案

 创建自动化配置文件

nano /root/answer.toml

[global]
keyboard = "de"
country = "cn"
fqdn = "pve.lan"
mailto = "[email protected]"
timezone = "Asia/Shanghai"
root_password = "123456"

[network]
source = "from-answer"
cidr = "192.168.1.210/24"
dns = "114.114.114.114"
gateway = "192.168.1.1"

[disk-setup]
filesystem = "ext4"
disk_list = ["nvme0n1"]

生成镜像

pve版本必须8.2及以上才支持创建自动化镜像

proxmox-auto-install-assistant prepare-iso /root/pve8.2.2.iso --fetch-from iso --answer-file /root/answer.toml

 

 

2.网络获取配置文件

安装配置文件服务器

docker和lxc都可以安装,项目地址autopve

docker使用范围广,这里提供docker-compose

version: "3.8"

services:
  autopve:
    image: ghcr.io/natankeddem/autopve:latest
    ports:
      - 8080:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ~/path/to/data:/app/data
      - ~/path/to/logs:/app/logs
    environment:
      - PUID=1000
      - PGID=1000
      - VERBOSE_LOGGING=TRUE # Optional

安装完成访问8080端口即可,键值按照官方文档自行添加修改即可,可以根据客户端信息分发不同配置文件

生成镜像

proxmox-auto-install-assistant prepare-iso /root/source.iso --fetch-from http --url "http://10.0.0.100:8080/answer"

例:proxmox-auto-install-assistant prepare-iso /root/pve-8.2.2.iso --fetch-from http --url "http://192.168.233.8:8080/answer"

/root/source.iso修改为源镜像路径,http://10.0.0.100/answer修改其中ip和端口为你自己搭建的配置服务器的ip和端口,也可使用域名

 

3.从分区读取(U盘等

在单独分区上应答

ISO 可以在标记为proxmox-aisPROXMOX-AISAutomated Installation Source)的文件系统上准备answer.toml(例如,在 USB 闪存驱动器上)。

proxmox-auto-install-assistant prepare-iso /path/to/source.iso --fetch-from partition

之后,准备USB U盘,例如在/dev/sdX1 上。然后,您可以调整并以root 身份运行以下命令:

# 格式为新的vFAT文件系统(DESTRUCTIVE!)
mkfs.vfat /dev/sdX1

# 设置标签
fatlabel /dev/sdX1 "PROXMOX-AIS"

# 挂载usb设备分区 
mkdir /mnt/usb
mount /dev/sdX1 /mnt/usb

# 复制配置文件到usb分区 "answer.toml"
cp my-prepared-answer.toml /mnt/usb/answer.toml

# 取消挂载usb分区
sync
umount /mnt/usb

 

从U盘获取,具体设置以及参数明细见官方文档

版权声明:
作者:laop
链接:https://laopy.dpdns.org/186.html
来源:LPY-老朋友
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录