Skip to content

Instantly share code, notes, and snippets.

@Jimmy-Z
Last active April 16, 2024 18:47
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Jimmy-Z/c4de0d15f89977a358996a171b9db668 to your computer and use it in GitHub Desktop.
Save Jimmy-Z/c4de0d15f89977a358996a171b9db668 to your computer and use it in GitHub Desktop.
create a Debian VM template for Proxmox VE
#!/bin/sh
# apt install curl
# obviously change this per your needs
VMID=9001
STOR=local-lvm
VER=20230124-1270
URL_PATH=https://cloud.debian.org/images/cloud/bullseye/$VER/
IMG=debian-11-genericcloud-amd64-$VER.qcow2
curl -L -o $IMG -C - $URL_PATH$IMG
# https://pve.proxmox.com/wiki/Cloud-Init_Support
# https://pve.proxmox.com/wiki/Qemu/KVM_Virtual_Machines
qm create $VMID --cores 4 --cpu cputype=host --memory 4096 --net0 virtio,bridge=vmbr0 --ostype l26 --serial0 socket --vga serial0
qm importdisk $VMID $IMG $STOR
qm set $VMID --scsihw virtio-scsi-single --scsi0 $STOR:vm-$VMID-disk-0,discard=on,iothread=true
qm set $VMID --ide2 $STOR:cloudinit
qm set $VMID --boot c --bootdisk scsi0
qm template $VMID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment