PVE Template Builder¶
PVE Template Builder creates VM templates in a Proxmox Virtual Environment
cluster. It takes a YAML specification file describing how to build a disk
image — packages to install, configuration adjustments, and shell-based
customizations — and how to publish the result as a template VM, and does
the rest: bootstrapping the OS with debootstrap, running the build steps
in a chroot, converting the image, and creating the template via the PVE
API.
See How a Template Is Built for the full sequence and host requirements, and Specification File Reference for every option in the spec file.
Quick start¶
-
Install
pve-template-builderand the tools it needs at build time. Download a release for Linux/amd64 — currently the only platform built — from Releases. The.debis the easiest path: installing it also pulls in every required tool automatically, via the package's ownaptdependencies:apt install ./pve-template-builder-<version>-amd64.debWith the
.tar.gzrelease, or building from source (go build ., Go 1.26+), install those tools yourself instead:apt install debootstrap gdisk dosfstools e2fsprogs qemu-utils apt-move apt-utilsSee Requirements for the full list, including what's needed for non-
ext4filesystems and for bootstrapping a different distribution than the build host's own. -
Write a spec file, or start from one of the examples in
example-specs/—debian.yamlandubuntu.yamlboth use the built-indebian-serial/ubuntu-serialpresets (see Presets) to get a bootable, serial-console VM template with only a few fields of your own.example.yamlin the same directory isn't meant to be built — it's a syntax reference showing every step kind in one file; seebuilder.steps. -
Build and publish it:
sudo pve-template-builder spec.yamlpve-template-buildermust run as root — creating nbd devices, mounting filesystems, andchrooting all require it. -
Or validate a spec file without building anything:
pve-template-builder -dry-run spec.yaml
Design notes¶
- One preset, one boot setup:
debian-serialandubuntu-serialprepend the same shared boot-setup step tobuilder.steps— a spec using a preset only needs to describe what makes that image different. See Presets. - No host mutation: everything happens inside a loop-mounted disk image and a chroot; the build host's own package state and filesystem are never touched.
For the reasoning behind these and other non-obvious choices, see Design Notes.