Skip to content

Instantly share code, notes, and snippets.

@mkol5222
Forked from adiberr/proxmox-cloudinit.md
Created July 13, 2025 17:59
Show Gist options
  • Save mkol5222/d0f58736928a389ccb89903458646f20 to your computer and use it in GitHub Desktop.
Save mkol5222/d0f58736928a389ccb89903458646f20 to your computer and use it in GitHub Desktop.
Proxmox Template with Cloud Image and Cloud Init

Download a cloud image :

# Example: Download Ubuntu Cloud Image
curl -LO https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

# Install quemu-guest-agent
apt update
apt install -y libguestfs-tools
virt-customize --install qemu-guest-agent -a /var/lib/vz/template/iso/noble-server-cloudimg-amd64.img

# Create a new virtual machine and add cloud init drive
qm create 8000 --memory 2048 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0
qm disk import 8000 /var/lib/vz/template/iso/noble-server-cloudimg-amd64.img local-lvm
qm set 8000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-8000-disk-0
qm set 8000 --ide2 local-lvm:cloudinit
qm set 8000 --boot c --bootdisk scsi0

# Optional: Add serial console
qm set 8000 --serial0 socket --vga serial0

# Use DHCP
qm set 8000 --ipconfig0 ip=dhcp

# Resize the disk
qm resize 8000 scsi0 20G

# Create a template
qm template 8000

# Optional: Clean up
rm /var/lib/vz/template/iso/noble-server-cloudimg-amd64.img

# Clone a template
qm clone 8000 125 --name graylog --full

Resources : Techno Tim, BoringTech.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment