Skip to content

Instantly share code, notes, and snippets.

@wildekek
Created August 10, 2025 21:08
Show Gist options
  • Save wildekek/5cd063d8f433e6046cd3ec802ec1105a to your computer and use it in GitHub Desktop.
Save wildekek/5cd063d8f433e6046cd3ec802ec1105a to your computer and use it in GitHub Desktop.
Create debian cloud template in Proxmox
#!/bin/bash
TEMPLATE_ID=9000
STORAGE="local-lvm"
BRIDGE="vmbr0"
# Download image
cd /var/lib/vz/template/iso/
wget -q https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
# Create and configure VM
qm create $TEMPLATE_ID --name debian12-cloud-template --memory 2048 --cores 2 --net0 virtio,bridge=$BRIDGE
qm importdisk $TEMPLATE_ID debian-12-generic-amd64.qcow2 $STORAGE
qm set $TEMPLATE_ID --scsihw virtio-scsi-pci --scsi0 $STORAGE:vm-$TEMPLATE_ID-disk-0
qm set $TEMPLATE_ID --ide2 $STORAGE:cloudinit
qm set $TEMPLATE_ID --boot c --bootdisk scsi0
qm set $TEMPLATE_ID --serial0 socket --vga serial0
qm set $TEMPLATE_ID --agent enabled=1
qm set $TEMPLATE_ID --ipconfig0 ip=dhcp
qm set $TEMPLATE_ID --ciuser debian
# Convert to template
qm template $TEMPLATE_ID
echo "Template created successfully with ID $TEMPLATE_ID"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment