Advanced

Creating and Using VM Templates in Proxmox VE

Learn how to create reusable VM templates in Proxmox for rapid deployment. Covers template creation, cloning, and customization.

ProxmoxR app icon

Managing Proxmox? Try ProxmoxR

Monitor and control your VMs & containers from your phone.

Try Free

Why Use VM Templates?

Every time you install an operating system from scratch — downloading the ISO, stepping through the installer, configuring packages, setting up users — you are spending 20-30 minutes on work that could be done in under a minute. VM templates in Proxmox VE solve this by letting you create a "golden image" of a fully configured VM and then stamp out copies on demand.

Templates are particularly valuable when you need multiple VMs with a similar base configuration — development environments, web servers, test nodes, or lab machines. Instead of repeating the installation process each time, you clone a template and make only the changes specific to that instance.

Template Workflow Overview

  1. Install and configure a VM exactly how you want your base image to look.
  2. Generalize the VM by removing machine-specific identifiers (hostname, SSH keys, machine-id).
  3. Convert the VM to a template.
  4. Clone the template whenever you need a new VM.
  5. Customize each clone with its unique settings.

Step 1: Prepare the Base VM

Start by creating a standard VM and installing your operating system of choice. During or after installation, configure everything you want in the base image:

  • Install common packages and updates
  • Configure the default user account
  • Set timezone and locale
  • Install monitoring agents or management tools
  • Harden SSH configuration
  • Apply security baselines

Example: Preparing an Ubuntu Server Base

# Update all packages
apt update && apt full-upgrade -y

# Install common tools
apt install -y vim curl wget git htop net-tools qemu-guest-agent

# Enable the QEMU guest agent (important for Proxmox integration)
systemctl enable qemu-guest-agent

# Set timezone
timedatectl set-timezone UTC

# Configure unattended security updates
apt install -y unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades

The QEMU guest agent is especially important — it allows Proxmox to communicate with the VM for clean shutdowns, IP address reporting, filesystem freeze during backups, and more.

Step 2: Generalize the VM (Sysprep)

Before converting to a template, you must remove machine-specific identifiers. If you skip this step, all clones will have the same hostname, SSH host keys, and machine-id — which causes network conflicts, security issues, and problems with tools that rely on unique machine identifiers.

Linux Generalization

# Clear the machine-id (will be regenerated on next boot)
truncate -s 0 /etc/machine-id
rm -f /var/lib/dbus/machine-id

# Remove SSH host keys (will be regenerated on next boot)
rm -f /etc/ssh/ssh_host_*

# Clear hostname (set a generic or blank one)
hostnamectl set-hostname localhost

# Remove persistent network rules if present
rm -f /etc/udev/rules.d/70-persistent-net.rules

# Clear bash history
history -c
cat /dev/null > ~/.bash_history

# Clear log files
find /var/log -type f -exec truncate -s 0 {} \;

# Remove temporary files
rm -rf /tmp/* /var/tmp/*

# If using DHCP, remove leases
rm -f /var/lib/dhcp/*.leases

# Clean apt cache
apt clean

# Shutdown the VM
shutdown -h now

Windows Generalization

For Windows VMs, use the built-in System Preparation Tool (Sysprep):

C:\Windows\System32\Sysprep\sysprep.exe /oobe /generalize /shutdown

This removes hardware-specific drivers, resets the Windows activation, and clears the SID. The next boot will present the Out-of-Box Experience (OOBE) wizard where you can set a new hostname and user.

Step 3: Optimize VM Hardware Settings

Before converting to a template, review and optimize the VM's hardware configuration:

# Use VirtIO for best performance
qm set 9001 --scsihw virtio-scsi-pci
qm set 9001 --net0 virtio,bridge=vmbr0

# Enable the QEMU guest agent in Proxmox
qm set 9001 --agent enabled=1

# Set CPU type to host for best performance (or kvm64 for migration compatibility)
qm set 9001 --cpu host

# Add a cloud-init drive if you plan to use cloud-init
qm set 9001 --ide2 local-lvm:cloudinit

Step 4: Convert to Template

With the VM shut down and generalized, convert it to a template:

# Via command line
qm template 9001

# Or in the web UI: right-click the VM → Convert to Template

The VM icon changes to a template icon in the Proxmox interface. Templates cannot be started — they can only be cloned. This protects your golden image from accidental modifications.

Step 5: Clone the Template

Proxmox offers two cloning modes, each with distinct trade-offs:

Full Clone

A full clone creates a complete, independent copy of the template disk. The clone has no dependency on the original template and can be freely modified, moved, or backed up independently.

qm clone 9001 110 --name "web-server-prod" --full

Pros: Complete independence, can delete the template without affecting clones, better for production workloads.
Cons: Uses the full disk space, cloning takes longer (must copy all data).

Linked Clone

A linked clone uses a copy-on-write strategy — it shares the template's base disk and only stores the differences. This makes cloning nearly instant and saves significant storage space.

qm clone 9001 111 --name "dev-server-01"

Pros: Very fast to create, minimal storage overhead initially.
Cons: Depends on the template — you cannot delete the template while linked clones exist. Performance can degrade as the delta grows. Not recommended for production.

When to Use Which

  • Full clones: Production servers, long-lived VMs, VMs that will diverge significantly from the template.
  • Linked clones: Development environments, testing, CI/CD runners, short-lived VMs, labs where storage is limited.

Post-Clone Customization

After cloning, configure the unique settings for each VM before booting:

# Set the hostname
qm set 110 --name "web-server-prod"

# Adjust resources for this specific workload
qm set 110 --cores 4 --memory 8192

# If using cloud-init, set the IP and user
qm set 110 --ipconfig0 ip=10.0.0.110/24,gw=10.0.0.1
qm set 110 --ciuser deploy --sshkeys ~/.ssh/authorized_keys

# Start the VM
qm start 110

If you are not using cloud-init, you will need to log into the VM after first boot and manually set the hostname, configure networking, and regenerate SSH host keys if needed.

Cloud-Init Integration with Templates

Templates become even more powerful when combined with cloud-init. By adding a cloud-init drive to your template, each clone can be automatically personalized at first boot — hostname, IP address, SSH keys, and custom scripts are all configured without manual intervention. See our dedicated cloud-init guide for a complete walkthrough of this workflow.

Template Management Strategies

Naming Conventions

Use a consistent naming scheme that includes the OS, version, and template date:

# Good naming examples:
ubuntu-2404-base-20260401      (VM ID 9001)
debian-12-docker-20260401      (VM ID 9002)
windows-2022-std-20260401      (VM ID 9003)
rocky-9-minimal-20260401       (VM ID 9004)

Template Lifecycle

  • Monthly updates: Rebuild templates monthly to include the latest security patches. This reduces the time each clone needs for post-boot updates.
  • Version rotation: Keep the current template and one previous version. Delete older versions once all their clones have been replaced or migrated.
  • Documentation: Maintain a simple list of what is installed in each template so you know what each clone inherits.

ID Range Reservations

Reserve a specific VM ID range for templates to keep them organized:

  • 9000-9099: Templates
  • 100-199: Production VMs
  • 200-299: Development/testing VMs

As your template library grows, being able to quickly check the state of VMs cloned from those templates becomes important — especially when you need to verify that new clones started correctly after a batch deployment. ProxmoxR provides a convenient way to review all your VMs and their status from your phone, making it easy to confirm successful deployments even when you are not at your workstation.

Summary

VM templates are one of the most practical features in Proxmox VE for anyone who deploys virtual machines regularly. By investing a few minutes in creating a well-prepared, generalized template, you save hours of repetitive installation work across every future deployment. Choose full clones for production stability and linked clones for development agility, combine templates with cloud-init for fully automated provisioning, and maintain a simple lifecycle strategy to keep your templates current. The result is faster, more consistent VM deployments with less manual effort.

Take Proxmox management mobile

All the features discussed in this guide — accessible from your phone with ProxmoxR. Real-time monitoring, power control, firewall management, and more.

ProxmoxR

Manage Proxmox from your phone

Monitor, control, and manage your clusters on the go.

Free 7-day trial · No credit card required