Proxmox Cloud-Init VM Template Creation
Configure cloud-init VM templates on Proxmox hypervisor for rapid VM deployment with automated initialization and custom configuration.
Status
live
Difficulty
intermediate
Time Required
45m
Last Tested
2026-06-01
Prerequisites
- Proxmox VE host with SSH access
- Cloud image URL (example: Ubuntu 22.04 LTS)
- Storage pool configured and accessible
Step 1: Download Cloud Image
Download the cloud image from the official Ubuntu image repository:
https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
You can also use the Proxmox GUI to download the ISO to /var/lib/vz/template/iso/.
Step 2: Create VM and Import Disk
Connect via SSH to your Proxmox host and execute the following commands. Replace values as needed:
# Create VM with ID 411, 10GB RAM, 12 cores
qm create 411 --memory 10240 --cores 12 --name Ubuntu-24.04 --net0 virtio,bridge=vmbr0
# Navigate to template directory
cd /var/lib/vz/template/iso/
# Import the cloud image disk to storage pool "tank"
qm importdisk 411 jammy-server-cloudimg-amd64-disk-kvm.img tank
# Attach SCSI controller and disk
qm set 411 --scsihw virtio-scsi-pci --scsi0 tank:vm-411-disk-0
# Attach cloud-init drive
qm set 411 --ide2 tank:cloudinit
# Set boot configuration
qm set 411 --boot c --bootdisk scsi0
# Configure serial port for console access
qm set 411 --serial0 socket --vga serial0
# Set cloud-init user and password
qm set 411 --ciuser dami --cipassword '[REDACTED]'
# Configure network (DHCP)
qm set 411 --ipconfig0 ip=dhcp
Step 3: Expand VM Disk
Expand the root disk to a suitable size (suggested 10 GB or larger):
qm resize 411 scsi0 +10G
Step 4: Modify Cloud-Init Configuration
In the Proxmox GUI:
- Navigate to the VM (ID 411)
- Select the "Cloud-Init" tab in the VM configuration
- Configure:
- User account name
- SSH public keys
- DNS settings
- Hostname
- Any custom scripts or configurations
Step 5: Create Template
Convert the VM to a template (this prevents accidental startup):
qm template 411
Or use the Proxmox GUI: Right-click the VM → Convert to Template
Step 6: Deploy VMs from Template
Clone the template to create new VMs:
# Full clone (independent copy)
qm clone 411 <NEW_VM_ID> --full --name <NEW_VM_NAME>
# Or use GUI: Right-click template → Clone
Network Configuration Options
DHCP Configuration
qm set 411 --ipconfig0 ip=dhcp
Static IP Configuration
# IPv4 only
qm set 411 --ipconfig0 ip=192.168.1.100/24,gw=192.168.1.1
# With IPv6
qm set 411 --ipconfig0 ip=192.168.1.100/24,gw=192.168.1.1 --ipconfig1 ip=fd00::2/64,gw=fd00::1
Cloud-Init User Data Script
Add custom initialization scripts via:
qm set 411 --ciupgrade true
Or create a cloud-init YAML script in the Proxmox GUI under Cloud-Init tab.
Verification
After deploying a VM from the template:
- Monitor console during boot
- Verify network connectivity:
ping <gateway> - Confirm cloud-init completed:
cloud-init status - Check user account creation:
id <ciuser>
Troubleshooting
- VM won't boot: Check BIOS/boot order in VM settings
- Network not configured: Verify cloud-init data in
cat /etc/cloud/cloud.cfg - SSH keys not installed: Check cloud-init user data section
- Disk space issues: Expand disk before template creation
Tips
- Always create a full clone when deploying for production
- Test the template with at least one deployment before mass cloning
- Keep the template VM powered off
- Document any custom cloud-init configurations for reproducibility