Skip to content

How To

How to create a Proxmox template using Cloud-Init and then full clone it as a Proxmox guest.

On the Promox Server...

Download a Cloud Image

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

Create a Template

qm create 9000 --name "ubuntu-cloud-init-template" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0

Import the Image to the Template

Change "local-lvm" to where you want to store it.

qm importdisk 9000 /var/lib/vz/template/iso/noble-server-cloudimg-amd64.img local-lvm

In my case it is "ZFS-MAIN", so...

qm importdisk 9000 /var/lib/vz/template/iso/noble-server-cloudimg-amd64.img ZFS-MAIN

Configure the Template

1
2
3
4
5
qm set 9000 --scsihw virtio-scsi-pci --scsi0 ZFS-MAIN:vm-9000-disk-0
qm set 9000 --boot c --bootdisk scsi0
qm set 9000 --ide2 ZFS-MAIN:cloudinit
qm set 9000 --ipconfig0 ip=dhcp
qm set 9000 --ciuser youruser --cipassword 'yourpassword'

Optional : Pull Public SSH Key(s)

curl -s https://github.com/Noxcivis.keys > /tmp/github_keys

Optional : Configure the Template for Your SSH Keys

qm set 9000 --sshkey /tmp/github_keys

Convert 9000 to a Proxmox Template

qm template 9000

Perform a Full Clone

Create a new Proxmox guest

qm clone 9000 250 --name "new-ubuntu-vm" --full
qm start 250

Want to Start Again ?

qm stop 9000
qm destroy 9000

Footnote

Thanks to the Facebook Proxmox Group for comments, suggestions and feedback contributing to the creation of this short how to.