Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Createing a Ubuntu 22.04 Template

Image source:

Download Image

Use the Proxmox GUI to download the image from the above URL

Customize the image

Use virt-customize to customize downloaded file:

virt-customize -a /var/lib/vz/template/iso/ubuntu-22.04-minimal-cloudimg-amd64.img --install qemu-guest-agent,jq,htop  --password "ubuntu:password:Password!"

Crete a VM

Use qm to create the VM:

qm create 9001 --name ubuntu-2204-cloudinit-template --memory 1024  --cpu cputype=host --cores 2 --sockets 1 --net0 virtio,bridge=vmbr0 --ostype l26
qm importdisk 9001 ubuntu-22.04-minimal-cloudimg-amd64.img local-lvm
qm set 9001 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9001-disk-0,discard=on,iothread=1,size=32G,ssd=1
qm set 9001 --boot c --bootdisk scsi0
qm set 9001 --ide2 local-lvm:cloudinit
qm set 9001 --serial0 socket --vga serial0
qm set 9001 --agent 1
mv ubuntu-22.04-minimal-cloudimg-amd64.img ubuntu-22.04.qcow2
qemu-img resize ubuntu-22.04.qcow2 32G
qm importdisk 9001 ubuntu-22.04.qcow2 local-lvm