How to prepare a Cloud-Init Templates with Proxmox

This article is a summary of prepping an Ubuntu Focal (20.04) cloud image for deployment as a VM.

The article was updated 8 November 2021 to provide a link to updating the Cloud-Init images with ‘qemu-guest-agent’ which is an essential tool when you’re running these services for your clients.

Normally Cloud-Init is installed like so:

apt-get install cloud-init

However, many distributions offered read-to-use Cloud-Init images as .qcow2 files. For Ubuntu, go here:

The one we’re after is `focal-server-cloudimg-amd64.img`

We’ve included scripts for Ubuntu, CentOS 7, and Debian. There are 8 steps per distribution. All that changes is the VM ID 9xxx and the download file.

Instructions for Ubuntu Focal 20.04 (9000)

virt-customize -a focal-server-cloudimg-amd64.img --install qemu-guest-agent
[optional for Virtualmin quotas] virt-customize -a focal-server-cloudimg-amd64.img --install linux-image-generic
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0
qm importdisk 9000 focal-server-cloudimg-amd64.img local-lvm
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9000-disk-0
qm set 9000 --ide2 local-lvm:cloudinit
qm set 9000 --boot c --bootdisk scsi0
qm set 9000 --serial0 socket --vga serial0
qm template 9000



Instructions for CentOS 7 (9001)

qm create 9001 –memory 2048 –net0 virtio,bridge=vmbr0
qm importdisk 9001 CentOS-7-x86_64-GenericCloud-2009.qcow2c local-lvm
qm set 9001 –scsihw virtio-scsi-pci –scsi0 local-lvm:vm-9001-disk-0
qm set 9001 –ide2 local-lvm:cloudinit
qm set 9001 –boot c –bootdisk scsi0
qm set 9001 –serial0 socket –vga serial0
qm template 9001

Instructions for Debian 11 – Bullseye (9002) – Released 14 August 2021


qm create 9002 –memory 2048 –net0 virtio,bridge=vmbr0
qm importdisk 9002 debian-11-generic-amd64-20210814-734.qcow2 local-lvm
qm set 9002 –scsihw virtio-scsi-pci –scsi0 local-lvm:vm-9002-disk-0
qm set 9002 –ide2 local-lvm:cloudinit
qm set 9002 –boot c –bootdisk scsi0
qm set 9002 –serial0 socket –vga serial0
qm template 9002

Instructions for Ubuntu 21.04

qm create 9003 –memory 2048 –net0 virtio,bridge=vmbr0
qm importdisk 9003 hirsute-server-cloudimg-amd64.img local-lvm
qm set 9003 –scsihw virtio-scsi-pci –scsi0 local-lvm:vm-9003-disk-0
qm set 9003 –ide2 local-lvm:cloudinit
qm set 9003 –boot c –bootdisk scsi0
qm set 9003 –serial0 socket –vga serial0
qm template 9003


Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top