# download the image from https://cloud-images.ubuntu.com/ wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img #apt install libguestfs-tools -y virt-customize -a /full/path-to/jammy-server-cloudimg-amd64.img --install qemu-guest-agent virt-customize -a /full/path-to/jammy-server-cloudimg-amd64.img --run-command "echo -n > /etc/machine-id" # create a new VM with VirtIO SCSI controller qm create 9000 --name VM-name --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci # import the downloaded disk to the local-lvm storage, attaching it as a SCSI drive qm set 9000 --scsi0 local-lvm:0,import-from=/full/path-to/jammy-server-cloudimg-amd64.img #resize VM disk image to production size #qm resize 9000 scsi0 +18G #add ide drive with cloudinit cd qm set 9000 --ide2 local-lvm:cloudinit #set scsi0 hard drive as first boot device qm set 9000 --boot order=scsi0 # qm set 9000 --serial0 socket --vga serial0 #conver to template qm template 9000