Skip to content

Instantly share code, notes, and snippets.

@grahamhelton
Last active May 29, 2024 15:34
Show Gist options
  • Save grahamhelton/ddfcb836a46eb9641b91b6f4c497addc to your computer and use it in GitHub Desktop.
Save grahamhelton/ddfcb836a46eb9641b91b6f4c497addc to your computer and use it in GitHub Desktop.
Proxmox: Prep ubuntu cloud image for use with terraform in a proxmox lab
# SSH to your proxmox server
ssh root@<proxmox_server>
# Update things and install libguestfs-tools
sudo apt update -y && sudo apt install libguestfs-tools -y
# Download ubuntu 20.04 image
# Alternatively, find the image you want from https://cloud-images.ubuntu.com/
wget https://cloud-images.ubuntu.com/focal/20240524/focal-server-cloudimg-amd64.img
# Install the qemu guest agent into the ubuntu image
virt-customize -a focal-server-cloudimg-amd64.img --install qemu-guest-agent
# Create the image named ubuntu-20.04 and set some defaults for image 1337
qm create 1337 --name "ubuntu-20.04" --memory 4096 --cores 2 -net0 virtio,bridge=vmbr0
# Import the ubuntu image disk
# Note, LVM is probably named something different for you depending on your
# proxmox storage setup
qm importdisk 1337 focal-server-cloudimg-amd64.img LVM
# Set some properties
qm set 1337 --scsihw virtio-scsi-pci --scsi0 LVM:vm-1337-disk-0
qm set 1337 --boot c --bootdisk scsi0
qm set 1337 --ide2 LVM:cloudinit
qm set 1337 --serial0 socket --vga serial0
qm set 1337 --agent enabled=1
# Create the template
qm template 1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment