These commands are for a NETLAB+ infrastructure and datastore named NETLAB1. If you are using a basic Proxmox install, your template location and datastore name may differ.
Go to your Proxmox datastore Navigate to Datacenter → Storage → ISOs.
Download the Ubuntu cloud image
https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img
Open a shell on your Proxmox host
Change into your ISO template directory
cd /mnt/pve/NETLAB1/template/isos
Install the guest‑fs tools if not already present:
apt update
apt install -y libguestfs-tools
Inject the QEMU guest agent into the image:
virt-customize \
-a ubuntu-24.04-server-cloudimg-amd64.img \
--install qemu-guest-agent
Create a cloud‑init config file that allows SSH password authentication:
virt-customize \
-a ubuntu-24.04-server-cloudimg-amd64.img \
--write /etc/cloud/cloud.cfg.d/99_enable_pwlogin.cfg:"#cloud-config
chpasswd:
list: |
ubuntu:password
expire: False
ssh_pwauth: True
"
Warning: Storing passwords in plaintext is insecure—use this only for testing or within a secured network.
Ensure each VM has a unique machine-id:
virt-customize \
-a ubuntu-24.04-server-cloudimg-amd64.img \
--run-command 'sed -i "1d" /etc/machine-id'
Create VM ID 7000 (adjust as needed) with 2 GB RAM, 2 CPU cores, and one virtio NIC bridged to vmbr0:
qm create 7000 \
--memory 2048 \
--cores 2 \
--name ubuntu-cloud \
--net0 virtio,bridge=vmbr0
Import the customized disk into storage NETLAB1:
qm importdisk 7000 \
ubuntu-24.04-server-cloudimg-amd64.img \
NETLAB1
Attach the disk as a SCSI device and enable cloud‑init:
qm set 7000 --scsihw virtio-scsi-pci --scsi0 NETLAB1:7000/vm-7000-disk-0.raw
qm set 7000 --ide2 NETLAB1:cloudinit
Configure boot order, QEMU agent, CPU, networking, and console:
qm set 7000 --boot c --bootdisk scsi0
qm set 7000 --agent enabled=1,fstrim_cloned_disks=1
qm set 7000 --cpu host
qm set 7000 --ipconfig0 ip=dhcp
qm set 7000 --serial0 socket --vga serial0
Mark the VM as a template so it can be cloned:
qm template 7000
Now you have a Proxmox VM template (ubuntu-cloud) ready to clone, with cloud‑init and QEMU guest agent installed. Cloned VMs will get fresh machine IDs and DHCP’d networking on first boot.