LinuxinfrastructureTested on real hardware

Create a Proxmox VM from the CLI (q35 + OVMF + VirtIO)

The full create-VM wizard as one qm command — q35 machine, OVMF firmware with EFI disk, host CPU, VirtIO SCSI and network, guest agent enabled, ISO attached and ready to install.

Distrosproxmox
Shellbash
Updated
Script
bash
# ── Run on the Proxmox host. Placeholders: VMID 100, name web01,
# ── local-lvm (VM disk storage), local (ISO storage), and the ISO
# ── filename. Wizard walkthrough: /blog/proxmox-create-vm/

qm create 100 \
  --name web01 \
  --machine q35 --bios ovmf --efidisk0 local-lvm:0,efitype=4m,pre-enrolled-keys=1 \
  --ostype l26 \
  --cpu host --cores 2 --memory 4096 --balloon 1 \
  --scsihw virtio-scsi-single \
  --scsi0 local-lvm:32,discard=on,ssd=1 \
  --net0 virtio,bridge=vmbr0 \
  --ide2 local:iso/ubuntu-24.04-live-server-amd64.iso,media=cdrom \
  --boot order='ide2;scsi0' \
  --agent enabled=1

qm start 100

Prerequisites

  • Proxmox VE 8.x/9.x host
  • An installer ISO already uploaded to your ISO storage (local by default)
  • Root shell on the node

What the flags mean

Every flag maps to a tab of the create-VM wizard — the full walkthrough explains each choice. The short version: q35 + OVMF is the modern default (required for PCIe passthrough), --cpu host gives full CPU features, VirtIO SCSI/network are the fast paravirtual devices, and --agent enabled=1 pre-enables the guest agent you install inside the OS after setup.

Notes

  • efitype=4m,pre-enrolled-keys=1 is load-bearing: the bare CLI default creates a legacy 2m EFI vars disk that hung a verification VM before boot on current PVE OVMF
  • For Windows guests change --ostype to win11 and expect to add VirtIO driver media during install
  • After the OS install: apt install qemu-guest-agent inside the guest
  • Skip the installer entirely next time with a cloud-init template