Skip to content

Instantly share code, notes, and snippets.

@chriswayg
Last active June 6, 2025 15:29
Show Gist options
  • Save chriswayg/b6421dcc69cb3b7e41f2998f1150e1df to your computer and use it in GitHub Desktop.
Save chriswayg/b6421dcc69cb3b7e41f2998f1150e1df to your computer and use it in GitHub Desktop.
Ubuntu and Debian Cloud images in Proxmox

Ubuntu Cloud image in Proxmox

Using a ready-to-use Ubuntu Cloud-Init image

  • steps for creating a template
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img

# create a VM
qm create 9000 --name ubuntu1804-templ --memory 2048 --net0 virtio,bridge=vmbr1

# Import the disk in qcow2 format (as unused disk) 
qm importdisk 9000 bionic-server-cloudimg-amd64.img local -format qcow2

# attach the disk to the vm using VirtIO SCSI
qm set 9000 --scsihw virtio-scsi-pci --scsi0 /var/lib/vz/images/9000/vm-9000-disk-0.qcow2

# Importtant settings
qm set 9000 --ide2 local:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0

# The initial disk is only 2GB
qm resize 9000 scsi0 +30G

# Use the dhcp server on vmbr1 or use static IP
qm set 9000 --ipconfig0 ip=dhcp
# , change with

# user authentication for 'ubuntu' user (optional password)
qm set 9000 --sshkey ~/.ssh/id_rsa.pub
qm set 9000 --cipassword AweSomePassword

# check the cloud-init config
qm cloudinit dump 9000 user

# create tempalte and full clone
qm template 9000
qm clone 9000 190 --name ubuntu1804-1
qm start 190

rm -v bionic-server-cloudimg-amd64.img
qm shutdown 190 && qm wait
qm resize 190 scsi0 +8G
qm start 190

Checking cloud-init

Convert Images

https://docs.openstack.org/image-guide/convert-images.html

qemu-img convert -f raw -O qcow2 bionic-server-cloudimg-amd64.img bionic-server-cloudimg-amd64.qcow2
@gdelanoy
Copy link

worked just fine.
Thanks.

FYI, following your gist with recent images also works fine.
Just

wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64-disk-kvm.img
or
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2

and adapt the file names where needed, and you're good to go;

@electropolis
Copy link

electropolis commented Feb 5, 2024

How you manage to do this
# Import the disk in qcow2 format (as unused disk) qm importdisk 9000 bionic-server-cloudimg-amd64.img local -format qcow2

When local "storage: storage 'local' does not support vm images" ?

@jgkawell
Copy link

jgkawell commented Mar 7, 2024

@electropolis You should be able to use local-lvm instead of local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment