Proxmox VE logo

Build a Software Review Lab with Proxmox, Part 2: Preparing the Debian Host for KVM

Get the Debian host ready for Proxmox: check the CPU, memory and disk, update Debian, install QEMU and KVM, create the Proxmox disk and write the script that starts it, one command at a time.

In this part you prepare the Debian computer the lab runs on. You check that it can run virtual machines, update it, install QEMU and KVM, give your user access to KVM, create an empty disk for Proxmox and write the script that starts it. There’s no Proxmox yet. That’s Part 3 and Part 4.

Every command below is its own step, with a screenshot of what it showed on my machine.

What you’ll end up with

The finished lab has three layers:

  • A Debian computer called sharewarepress. This is the physical machine, the host.
  • Proxmox VE running as a virtual machine on that host, managed from a web browser.
  • Windows test machines inside Proxmox, each with a clean snapshot to roll back to after every review.

This part builds the first layer. When you’re done, the host has QEMU and KVM installed, an empty 200 GB disk waiting for Proxmox, and a script that starts the Proxmox machine with or without the installer.

What you need

  • A 64-bit computer running Debian 13, with an account that can use sudo.
  • Hardware virtualization turned on in the BIOS/UEFI setup.
  • A terminal. Every step is a command you type and a result you compare.

Note: Hardware virtualization is called AMD-V or SVM on AMD boards and Intel VT-x on Intel boards, and the menu it lives in differs from board to board. Steps 2 and 4 tell you whether it’s on.

Step 1: Check the operating system

Show the Debian version:

cat /etc/os-release
Terminal window showing the output of cat /etc/os-release: Debian GNU/Linux 13 (trixie), version 13.7.Open larger screenshot
The host runs Debian GNU/Linux 13 “trixie”, version 13.7.

Look at PRETTY_NAME, which should say Debian GNU/Linux 13 (trixie), and DEBIAN_VERSION_FULL, which says 13.7 here. The rest are links and IDs.

Then show the kernel and the machine name:

uname -a
Terminal window showing uname -a: Linux sharewarepress, kernel 6.12.113+deb13-amd64, x86_64.Open larger screenshot
uname -a: the machine name sharewarepress and the Debian 6.12 kernel for x86_64.

The second word, sharewarepress, is the host name. After it comes the kernel version, 6.12.113, and at the end x86_64, which means a 64-bit system.

I run the host on Debian for a few reasons. Proxmox VE is built on Debian, so the tools and the way things work on the host are the same ones you’ll see inside Proxmox later. It’s stable, and a lab host should be boring: the apps under test should break, not the machine under them. It has a large community, so most questions have been asked before. And many distributions, like Ubuntu, are based on Debian, so what you learn here carries over.

Step 2: Check the CPU and virtualization support

lscpu | grep -v Flags

lscpu prints a lot, including a long Flags line that lists everything the CPU supports. You don’t need to read it, so grep -v Flags leaves it out:

Terminal window showing lscpu with the Flags line filtered out: x86_64, AMD Ryzen 9 7950X 16-Core Processor, 16 cores per socket and Virtualization AMD-V.Open larger screenshot
lscpu without the Flags line: an AMD Ryzen 9 7950X with 16 cores per socket.

Look at Model name, which is AMD Ryzen 9 7950X here, and Core(s) per socket, which is 16. The line that matters most is Virtualization, so pull it out on its own:

lscpu | grep -A1 'Virtualization'
Terminal window showing lscpu filtered with grep -A1 for Virtualization: Virtualization AMD-V, followed by the L1d cache line.Open larger screenshot
lscpu filtered down to the Virtualization line: AMD-V.

Expected result: Virtualization: AMD-V, which means the CPU’s hardware virtualization is available to this system. On an Intel machine, that line says VT-x instead of AMD-V. The -A1 also prints the line after the match, which is why L1d cache shows up too.

Step 3: Check memory and disk space

Check the memory:

free -h
Terminal window showing free -h: 31Gi total memory, 3.0Gi used, 28Gi available, 15Gi swap.Open larger screenshot
free -h: 31Gi of memory in total, 28Gi available.

The -h makes the numbers readable. Look at the Mem: line: 31Gi total and 28Gi available.

Note: The machine has 32 GB; free shows a bit less because the system reserves some.

Then check the disk the system is on:

df -h /
Terminal window showing df -h /: /dev/sda1, size 476G, 8.1G used, 444G available, 2% used, mounted on /.Open larger screenshot
df -h /: a 476G disk with 444G available.

Size is 476G, and Avail says 444G is free. That’s where the Proxmox disk goes in Step 9.

Step 4: Check the KVM device

ls -l /dev/kvm
Terminal window showing ls -l /dev/kvm: a character device owned by root and the kvm group, read and write for both.Open larger screenshot
/dev/kvm exists and belongs to the kvm group.

Expected result: /dev/kvm exists, owned by root and the group kvm, with read and write for both. Remember the group name. You need it in Step 7.

Warning: If /dev/kvm is missing, or lscpu shows no Virtualization line, stop here. Virtualization is off in the BIOS/UEFI. Turn it on there, then check again. Nothing after this step will run at a usable speed without it.

Here is what this host has:

ItemThis host
Operating systemDebian 13 “trixie” (13.7)
CPUAMD Ryzen 9 7950X, 16 cores
VirtualizationAMD-V, /dev/kvm present
Memory32 GB
Disk476 GB, 444 GB free

Proxmox needs a 64-bit CPU with hardware virtualization turned on, enough memory for Proxmox itself plus every machine you plan to run inside it, and enough disk space for those machines’ virtual disks. This host has more than enough for the lab in this series.

Step 5: Update Debian

Always update before installing new packages. First, refresh the package lists:

sudo apt update
Terminal window showing sudo apt update: the sudo password prompt, the package sources being checked and the line All packages are up to date.Open larger screenshot
sudo apt update asks for the password, reads the package sources and reports that all packages are up to date.

Note: sudo asks for your password first. Nothing shows while you type it, not even dots. Type it and press Enter.

Each Hit or Get line is a package source being checked. The last line is the one to read: “All packages are up to date.”

Then install whatever upgrades there are:

sudo apt full-upgrade -y
Terminal window showing sudo apt full-upgrade -y with a summary of 0 upgrading, 0 installing, 0 removing and 0 not upgrading.Open larger screenshot
sudo apt full-upgrade -y: nothing to upgrade, install or remove.

The -y answers yes for you. Here the summary says 0 for everything, so there was nothing to do. The point is to start from a current system. If yours upgrades a lot, especially the kernel, restart before you continue.

Step 6: Install QEMU and KVM tools

KVM is built into the Linux kernel. QEMU is the program that uses it to run virtual machines. Install three packages in one command:

sudo apt install -y -qq qemu-system-x86 qemu-utils ovmf

Tip: The -qq just hides apt’s progress output. You still see what it installs.

  • qemu-system-x86 gives you qemu-system-x86_64, the program that runs the Proxmox machine.
  • qemu-utils gives you qemu-img, which creates and inspects virtual disks.
  • ovmf is UEFI firmware for virtual machines. The launch script doesn’t use it; it’s there for a UEFI machine later.
Terminal window showing sudo apt install -y -qq qemu-system-x86 qemu-utils ovmf: the Installing list, the Installing dependencies list, the Summary with Installing: 7, then the first Selecting and Unpacking lines.Open larger screenshot
The start of the install: apt lists the three packages, four dependencies and a summary of seven to install.

apt first lists what it’s about to install: the three packages you asked for, plus four it pulls in to go with them. Then it unpacks everything.

Terminal window showing the end of the QEMU install: Setting up lines for qemu-system-x86, ovmf, qemu-utils and related packages, then a Processing triggers line and the prompt.Open larger screenshot
The end of the install output: qemu-utils, qemu-system-x86 and the other QEMU packages being set up.

Expected result: the output is long. At the end you want a list of Setting up lines, including qemu-utils and qemu-system-x86, then a Processing triggers line and your prompt back, with no error.

Check that both programs are there. First QEMU itself:

qemu-system-x86_64 --version
Terminal window showing qemu-system-x86_64 --version: QEMU emulator version 10.0.13 (Debian 1:10.0.13+ds-0+deb13u1).Open larger screenshot
qemu-system-x86_64 reports QEMU emulator version 10.0.13.

Then the disk tool:

qemu-img --version
Terminal window showing qemu-img --version: qemu-img version 10.0.13 (Debian 1:10.0.13+ds-0+deb13u1).Open larger screenshot
qemu-img reports version 10.0.13.

Both report version 10.0.13.

Step 7: Give your user access to KVM

/dev/kvm belongs to the kvm group, as Step 4 showed. If your user isn’t in that group, QEMU can’t use KVM, and you end up running QEMU as root or running it without KVM. Neither is what you want. Add your user to the group:

sudo usermod -aG kvm $USER
Terminal window showing sudo usermod -aG kvm $USER followed by a new prompt with no output.Open larger screenshot
sudo usermod -aG kvm $USER finishes without any output.

No output means it worked. $USER is your own user name, so you don’t have to type it.

Warning: The -a matters. Without it, usermod -G replaces your other groups instead of adding one.

Check it:

getent group kvm
Terminal window showing getent group kvm with the result kvm:x:993:user.Open larger screenshot
getent group kvm shows the kvm group with my user in it.

Expected result: a line like kvm:x:993:user. That’s the group name, a placeholder for the password, the group number and, at the end, its members. My user is called user, so that’s me.

Note: Log out and back in after this. A new group only applies to new logins. Until then, your current session doesn’t have it yet, even though getent already shows it.

Step 8: Plan the network

Proxmox runs with QEMU’s user-mode networking. The Proxmox machine sits behind QEMU’s own small network and reaches the internet through the host. There’s no bridge and no change to the host’s network settings. The catch is that nothing can reach Proxmox unless you forward a port to it. You need two:

Host portGoes toWhat for
127.0.0.1:8006Proxmox port 8006The Proxmox web interface, at https://localhost:8006
127.0.0.1:2222Proxmox port 22SSH into Proxmox, for later

Note: Both are bound to 127.0.0.1, so only the host itself can open them. For a machine where you install software you don’t trust yet, that’s what you want.

A bridge would be faster, but the lab doesn’t need the speed. The plan goes into the launch script in Step 10.

Step 9: Create the lab folders and the Proxmox disk

Create the folders for the lab:

mkdir -p ~/lab/proxmox ~/lab/iso
Terminal window showing mkdir -p ~/lab/proxmox ~/lab/iso followed by a new prompt with no output.Open larger screenshot
mkdir -p creates the lab folders without any output.

~/lab/proxmox holds the disk and ~/lab/iso holds the installer in Part 3. The -p creates ~/lab too, and doesn’t complain if a folder already exists.

Then create the disk itself:

qemu-img create -f qcow2 ~/lab/proxmox/proxmox.qcow2 200G
Terminal window showing qemu-img create -f qcow2 ~/lab/proxmox/proxmox.qcow2 200G and the Formatting line with fmt=qcow2 and size=214748364800.Open larger screenshot
qemu-img create formats proxmox.qcow2 as a 200G qcow2 disk.

The Formatting line confirms the file name, the format qcow2 and the size in bytes, 214748364800, which is 200 GiB. The rest are qcow2 settings left at their defaults.

Look at what was created:

qemu-img info ~/lab/proxmox/proxmox.qcow2
Terminal window showing qemu-img info for proxmox.qcow2: file format qcow2, virtual size 200 GiB, disk size 196 KiB.Open larger screenshot
qemu-img info: a virtual size of 200 GiB, but a disk size of only 196 KiB.

Expected result: two lines matter. virtual size: 200 GiB is how big the disk looks to Proxmox. disk size: 196 KiB is how much space it actually takes on the host right now.

Tip: The disk is thin. It only grows as Proxmox and its machines write data. Thin disks fill up quietly, so keep an eye on free space.

Step 10: Write the launch script

Typing a long QEMU command every time gets old fast, so the whole thing goes into one script. Open it in nano, the simple text editor that comes with Debian:

nano ~/lab/start-proxmox.sh

Type the script in:

#!/bin/bash
# Start the Proxmox VE lab VM.
# Usage: ./start-proxmox.sh             boot from the disk
#        ./start-proxmox.sh install.iso boot the installer
set -e
LAB="$HOME/lab"
ISO="$1"
ARGS=(
  -name proxmox-lab
  -machine q35,accel=kvm
  -cpu host
  -smp 12
  -m 24G
  -drive file="$LAB/proxmox/proxmox.qcow2",if=virtio,format=qcow2,cache=none,discard=unmap
  -netdev user,id=net0,hostfwd=tcp:127.0.0.1:8006-:8006,hostfwd=tcp:127.0.0.1:2222-:22
  -device virtio-net-pci,netdev=net0
  -vga virtio
  -display gtk
)
if [ -n "$ISO" ]; then
  ARGS+=( -cdrom "$ISO" -boot once=d )
fi
exec qemu-system-x86_64 "${ARGS[@]}"
The nano editor open on /home/user/lab/start-proxmox.sh with the full launch script typed in and not saved yet.Open larger screenshot
The launch script typed into nano, not saved yet.

The * after the file name at the top means it isn’t saved yet. The colors are nano’s, not part of the file.

Tip: The two shortcut rows at the bottom are nano’s menu; ^ means Ctrl. So ^O Write Out is Ctrl+O and ^X Exit is Ctrl+X.

To save, press Ctrl+O. nano asks for the file name, already filled in:

The nano editor after pressing Ctrl+O, with the Write to File prompt showing /home/user/lab/start-proxmox.sh.Open larger screenshot
After Ctrl+O, nano asks where to write the file, with the script’s path filled in.

Press Enter to keep it:

The nano editor after saving, with the status message Wrote 23 lines at the bottom.Open larger screenshot
After Enter, nano reports “Wrote 23 lines”.

nano says “Wrote 23 lines”, and the * is gone from the top. Press Ctrl+X to leave nano.

What each part of the script does:

  • set -e stops the script at the first command that fails.
  • LAB is the lab folder. ISO is the first argument, if you give one.
  • -name proxmox-lab names the machine, so the window title says what it is.
  • -machine q35,accel=kvm uses QEMU’s newer q35 machine type and runs it with KVM. Without accel=kvm, QEMU would emulate the CPU and everything would crawl.
  • -cpu host passes the host CPU’s features through. Proxmox needs the virtualization flag to run its own machines, and this is how it gets it.
  • -smp 12 and -m 24G give Proxmox 12 of the 16 cores and 24 GB of the 32 GB. That leaves 4 cores and 8 GB for Debian itself.
  • -drive … attaches the qcow2 disk as a virtio disk. cache=none skips the host’s file cache, and discard=unmap lets space freed inside the machine be given back to the qcow2 file.
  • -netdev user,… is the user-mode network with the two port forwards from Step 8.
  • -device virtio-net-pci is the network card Proxmox sees.
  • -vga virtio and -display gtk show the machine’s screen in a window on the host desktop. The installer needs a screen.
  • The if block adds the ISO as a CD and boots from it once (-boot once=d) when you pass an ISO. After the next restart, it boots from the disk again.
  • exec replaces the script with QEMU, so closing QEMU ends everything cleanly.

Make the script executable, so you can run it by its name:

chmod +x ~/lab/start-proxmox.sh
Terminal window showing chmod +x ~/lab/start-proxmox.sh followed by a new prompt with no output.Open larger screenshot
chmod +x makes the script executable, without any output.

No output again, which is what you want.

Step 11: Check the script and the files

There’s no installer to boot yet, but you can check the script and the files.

Check the script’s syntax:

bash -n ~/lab/start-proxmox.sh
Terminal window showing bash -n ~/lab/start-proxmox.sh followed by a new prompt with no output.Open larger screenshot
bash -n reads the script without running it and prints nothing, so there are no syntax errors.

bash -n reads the script without running it. If there were a mistake, it would print an error with the line number. Expected result: nothing, so the syntax is fine.

Check the lab folder:

ls -l ~/lab
Terminal window showing ls -l ~/lab: the iso and proxmox folders and the executable file start-proxmox.sh, 624 bytes.Open larger screenshot
ls -l ~/lab: the iso and proxmox folders and the executable start-proxmox.sh.

Expected result: two folders, iso and proxmox, and start-proxmox.sh at 624 bytes. The x letters in -rwxrwxr-x mean it’s executable, which is what chmod +x did.

Check the disk folder:

ls -lh ~/lab/proxmox
Terminal window showing ls -lh ~/lab/proxmox: one file, proxmox.qcow2, 196K.Open larger screenshot
ls -lh ~/lab/proxmox: proxmox.qcow2 at 196K.

Expected result: one file, proxmox.qcow2, at 196K, the same as qemu-img info said.

If something goes wrong

  • bash -n prints an error: compare your script with the one in Step 10, at the line number it gives. A missing bracket or quote is the usual reason.
  • Permission denied when you run the script: the chmod +x step was skipped.
  • QEMU later complains about permission on /dev/kvm: you probably didn’t log out and back in after adding yourself to the kvm group.

What’s next

The host is ready. QEMU and KVM are installed, your user can use KVM, the disk exists and the launch script is written and checked. What’s missing is Proxmox itself.

In Part 3, “Downloading and Verifying the Proxmox VE ISO”, you download the Proxmox VE installer into ~/lab/iso and check it, so this script has something to boot.

Discussion

Was this helpful?

Your first vote needs no account.

Open a fresh voting form

Leave a Reply

Your email address will not be published. Required fields are marked *

You can post one comment as a guest across the site.

Related posts

BUILDASO.PCX

Search

Press / or Ctrl K to search from any page. Esc closes.

Your account

Necessary Always active

Shareware Press stores your cookie choices for 180 days in sp_consent. Opening the rating form sets sp_voter for one year to retrieve and update your vote. Starting an article Discussion or Helpful action sets sp_article_receipts for one year to prove that specific submission; linking it also needs a matching verified account. WordPress uses login and settings cookies for signed-in users, and comment-author cookies for one year when you ask it to remember your details.

Cookie Policy · Privacy Policy

Consent record reference