Create a Proxmox VM Template for Ubuntu 20.04

Some necessary details for creating a Virtual Machine Template for Ubuntu 20.04 in Proxmox 7.0.
I wanted a quick machine I could spin up to start installing various Kubernetes Flavours.
Here is what I setup:

  1. Perform a custom install.
    /boot - 1 GiB
    /     - Everything else
    
  2. Upon successfull install, remove swap.
    # /etc/fstab
    # /swap.img  # comment out line
    
    # disable swap
    sudo swapoff -a 
    sudo rm -vf /swap.img
    
  3. Install qemu agent
    sudo apt install qemu-guest-agent
    sudo systemctl enable --now qemu-guest-agent
    
    Proxmox -> Options -> Qemu Guest Agent -> Enabled
    
  4. Update everything
    sudo apt update && sudo apt upgrade -y
    
  5. Remove apt caches
    sudo apt clean
    sudo apt autoremove
    
  6. Remove machine-id
    truncate -s 0 /etc/machine-id
    
    # check if machine-id points to that file
    sudo ls -l /var/lib/dbus/machine-id
    /var/lib/dbus/machine-id -> /etc/machine-id
    
  7. Clear SSH Host Keys
    cd /etc/ssh
    rm -vf ssh_host_*
    
  8. Shutdown -> Hardware
    1. -> remove CDROM
    2. -> Add Cloud-init drive
    3. -> Add Serial Port (Cloud-init Requirement)
  9. Convert Machine to template.