Linux VPS

Create a cloud-init VM template in Proxmox VE

Build a reusable cloud-init template in Proxmox VE from an Ubuntu or Debian cloud image, set SSH keys and IPs per clone, and deploy new Linux VMs in seconds with qm commands.

IntermediateProxmox VE2 min read

Installing Linux from an ISO every time is slow. A Proxmox cloud-init template lets you clone a ready image and set the hostname, user, SSH key and IP at first boot, so a new VM is ready in under a minute. This is the same approach VPS providers use for fast provisioning.

Before you start

  • A working Proxmox VE host; see install Proxmox VE.
  • Shell access to the node (node → Shell or SSH).
  • A storage for VM disks, such as local-lvm or a ZFS pool.
  • Pick an unused VM ID for the template, e.g. 9000.

Download a cloud image

cd /var/lib/vz/template/iso && wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

Debian publishes equivalent genericcloud qcow2 images.

Create the template VM

qm create 9000 --name ubuntu-2404-tpl --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-single
qm importdisk 9000 noble-server-cloudimg-amd64.img local-lvm
qm set 9000 --scsi0 local-lvm:vm-9000-disk-0,discard=on --boot order=scsi0
qm set 9000 --ide2 local-lvm:cloudinit --serial0 socket --vga serial0 --agent enabled=1

On newer Proxmox releases qm disk import is the preferred spelling of importdisk. Adjust the storage name to yours.

Set cloud-init defaults

In the GUI open VM 9000 → Cloud-Init and set user, password or SSH public key, DNS and IP Config (DHCP or static). Or from the shell:

qm set 9000 --ciuser admin --sshkeys /root/admin.pub --ipconfig0 ip=dhcp

Then convert it:

qm template 9000

Deploy a VM from the template

qm clone 9000 120 --name web01 --full
qm set 120 --ipconfig0 ip=203.0.113.20/24,gw=203.0.113.1 --nameserver 1.1.1.1
qm resize 120 scsi0 +30G
qm start 120

Cloud images grow their root partition automatically on first boot. Log in with your key: ssh admin@203.0.113.20.

After first boot

  • Install qemu-guest-agent in the template image (or each clone) so Proxmox shows IPs and shuts down cleanly.
  • Harden SSH; see SSH lockdown checklist.

Troubleshooting

  • VM does not get settings: the cloud-init drive is missing; re-add ide2 as cloudinit and click Regenerate Image.
  • Stuck at boot with no console: the serial console must be enabled as above.
  • Disk did not grow: confirm the resize, then reboot; growpart runs at boot.

Frequently asked questions

Full or linked clone?

Full clones are independent copies. Linked clones save space but depend on the template.

Does this work with Windows?

Windows uses cloudbase-init instead and needs a sysprepped image.

Can I add custom cloud-init config?

Yes, put a snippet file on a storage with snippets content and use --cicustom.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.