How to Install KVM, QEMU and Libvirt on Debian 12 (Bookworm)

If you want to install KVM QEMU and Libvirt on Debian 12, this guide will help you step by step. We will use Debian GNU/Linux 12 (Bookworm) for all future examples in this series.

Therefore, make sure you install the correct Debian version. This ensures consistency across all tutorials.

Step 1: Create a Debian 12 Virtual Machine

Before you install KVM, you need a working Debian system.

You can create a VM using:

However, if you already run Linux on bare metal, you can skip this step.

Minimum VM Requirements

Use the following minimum specifications for Debian GNU/Linux 12 (Bookworm):

ResourceMinimum RequirementRecommended
CPU2 vCPU4 vCPU
RAM2 GB4 GB
Storage20 GB40 GB
NetworkNAT or BridgedBridged

Because virtualization needs resources, avoid using less than 2 GB RAM.

Step 2: Install Debian GNU/Linux 12 (Bookworm)

Download and install:

Debian GNU/Linux 12 (Bookworm)

Choose:

  • Standard system utilities
  • SSH server (recommended)

After installation, update the system:

sudo apt update && sudo apt upgrade -y

This ensures your system has the latest security updates.

Step 3: Verify CPU Virtualization Support

Before you install KVM QEMU and Libvirt on Debian 12, check CPU support.

Run:

bxtgeek@Orion:~$ egrep -c '(vmx|svm)' /proc/cpuinfo
2

If the output is 1 or higher, virtualization is supported.

If you see 0, enable virtualization in BIOS or UEFI.

Step 4: Install KVM, QEMU and Libvirt

Now install the required packages:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst -y

This installs:

  • KVM kernel module
  • QEMU hypervisor
  • Libvirt service
  • Network bridge utilities
  • VM creation tools

After installation, enable and start libvirt:

sudo systemctl enable libvirtd
sudo systemctl start libvirtd

Then verify:

sudo systemctl status libvirtd

Step 5: Add Your User to Libvirt Group

To avoid using sudo every time, add your user:

sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER

Log out and log back in.

Because of this, you can manage VMs without root privileges.

Step 6: Verify Installation

Check KVM support:

virsh list --all

If no error appears, the setup works correctly.

You can also verify:

lsmod | grep kvm

If you see kvm_intel or kvm_amd, KVM is active.

What Happens After Installation?

When you install KVM QEMU and Libvirt on Debian 12:

  • KVM provides hardware acceleration
  • QEMU runs virtual machines
  • Libvirt manages everything
  • Virsh allows CLI control

Therefore, you now have a complete virtualization stack.

FAQ Section

Why must I use Debian GNU/Linux 12 (Bookworm)?

Because all future examples in this series use Debian 12.

Can I install this on Debian 13?

Yes. However, commands may differ slightly.

Do I need a GUI?

No. You can manage everything using the terminal.

Is 2 GB RAM enough?

Yes, but 4 GB provides better performance.

Can I run this inside VirtualBox or UTM?

Yes. However, nested virtualization must be enabled.

Conclusion

In this guide, you learned how to install KVM QEMU and Libvirt on Debian 12 (Bookworm). You also created a proper virtual machine with minimum requirements.

Now your system is ready for virtualization. In the next article, we will create and manage virtual machines using virsh on Debian GNU/Linux 12.


7 Comments

Leave a Reply

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