Skip to content

Instantly share code, notes, and snippets.

@NickBouwhuis
Created October 6, 2024 10:09
Show Gist options
  • Save NickBouwhuis/771de40a4244cfc126e72cd744e071d0 to your computer and use it in GitHub Desktop.
Save NickBouwhuis/771de40a4244cfc126e72cd744e071d0 to your computer and use it in GitHub Desktop.
Script to make a Debian 12 template on Proxmox based on its cloud image
#!/bin/bash
# download the image
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
# create a new VM
qm create 9012 --name bookworm --memory 2048 --net0 virtio,bridge=vmbr0
# import the downloaded disk to local-lvm storage
qm importdisk 9012 debian-12-generic-amd64.qcow2 local-lvm
# finally attach the new disk to the VM as scsi drive
qm set 9012 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9012-disk-0
# add cloud-init config
qm set 9012 --ide2 local-lvm:cloudinit
qm set 9012 --boot c --bootdisk scsi0
qm set 9012 --serial0 socket --vga serial0
# make it a template
qm template 9012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment