proxmox
Getting Started with Proxmox VE LXC and VM Templates
Proxmox VE (PVE) allows users to create and manage both LXC containers and KVM virtual machines (VMs). This guide walks you through the process of downloading, importing, and creating templates for both.
LXC Templates
LXC containers are lightweight and ideal for running Linux services with minimal overhead.
List Available Templates
To view the available LXC templates:
Download Templates
Use the pveam download command to import templates to the local storage:
pveam download local ubuntu-24.04-standard_24.04-1_amd64.tar.zst
pveam download local debian-12-standard_11.7-1_amd64.tar.zst
Once downloaded, these templates can be used to create new LXC containers from the Proxmox web interface or via CLI.
VM Template from Ubuntu Cloud Image
KVM VMs are ideal when you need full virtualization, for instance, to run Windows or more complex Linux systems.
Download Ubuntu Cloud Image
Download the official Ubuntu 24.04 cloud
Create the Virtual Machine
Create a new VM with ID 910 (you can pick any unused ID):
Import and Attach the Disk
Choose the correct storage (replace nvme if you use a different storage name):
qm set 910 -scsihw virtio-scsi-pci -virtio0 nvme:vm-910-disk-0
Configure the VM
qm set 910 -boot c -bootdisk virtio0
qm set 910 -agent 1
qm set 910 -hotplug disk,network,usb
qm set 910 -vcpus 1
qm set 910 -vga qxl
qm set 910 -ide2 nvme:cloudinit
qm resize 910 virtio0 +8G
If your disk is using SCSI instead of virtio, resize like this:
Convert the VM into a Template
Now you can use this template to clone new VMs instantly.
Bash Script to Automate Setup
Install the above using bash script below
setup_proxmox_templates.sh
# Exit on errors
set -e
echo "Downloading LXC templates..."
pveam download nvme ubuntu-22.04-standard_22.04-1_amd64.tar.zst
pveam download nvme ubuntu-24.04-standard_24.04-2_amd64.tar.zst
pveam download nvme alpine-3.21-default_20241217_amd64.tar.xz
pveam download nvme debian-12-standard_12.7-1_amd64.tar.zst
echo "Downloading Ubuntu cloud image..."
wget -N http://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
echo "Creating VM Template..."
qm create 910 -name template-ubuntu-jammy -memory 2048 -net0 virtio,bridge=vmbr0 -cores 2 -sockets 1 && 1
# qm importdisk 910 ubuntu-24.04-server-cloudimg-amd64.img nvme
# qm set 910 -scsihw virtio-scsi-pci -scsi0-virtio0 nvme:910/vm-910-disk-0
qm set 910 -scsihw virtio-scsi-pci -scsi0 nvme:0,import-from=/mnt/nvmestorage/template/iso/ubuntu-24.04-server-cloudimg-amd64.img
qm set 910 -serial0 socket
qm set 910 -boot c -bootdisk virtio0
qm set 910 -agent 1
qm set 910 -hotplug disk,network,usb
qm set 910 -vcpus 1
qm set 910 -vga qxl
qm set 910 -ide2 nvme:cloudinit
# qm resize 910 scsi0 +8G
read -p "Confirm converting to template by pressing Enter"
qm template 910
echo "Templates setup complete."