Skip to content

Instantly share code, notes, and snippets.

@bvierra
Created July 12, 2023 05:44
Show Gist options
  • Save bvierra/ec7fd87d7afafe3eeb056b0d1df406db to your computer and use it in GitHub Desktop.
Save bvierra/ec7fd87d7afafe3eeb056b0d1df406db to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
wget https://cloud-images.ubuntu.com/jammy/current/SHA256SUMS
cat SHA256SUMS | grep jammy-server-cloudimg-amd64.img > sha256sum
sha256sum --check sha256sum
qm create 8000 --name ubuntu-22.04-server-template --memory 1024 --net0 virtio,bridge=vmbr0 --cores 1 --sockets 1 --cpu cputype=host --description "Ubuntu 22.04 (jammy) server with cloud-init image" --kvm 1 --numa 1
qm importdisk 8000 jammy-server-cloudimg-amd64.img proxmox-nfs
qm disk rescan
qm set 8000 --scsihw virtio-scsi-pci --virtio0 proxmox-nfs:8000/vm-8000-disk-0.raw
qm set 8000 --serial0 socket
qm set 8000 --boot c --bootdisk virtio0
qm set 8000 --agent 1
qm set 8000 -hotplug disk,network,usb,memory,cpu
qm set 8000 -vcpus 1
qm set 8000 -name ubuntu-22.04-server-template
qm set 8000 -ide2 proxmox-nfs:cloudinit
qm set 8000 -sshkey bvierra.pub
qm disk resize 8000 virtio0 10G
virt-customize --colors -a jammy-server-cloudimg-cust.img --update --install qemu-guest-agent --ssh-inject root:file:bvierra.pub --timezone America/Los_Angeles
virt-sysprep --colors -a jammy-server-cloudimg-cust.img --operations defaults,-ssh-userdir
qm template 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment