How to Install and Configure KVM on Ubuntu 24.04
Learn how to install KVM on Ubuntu 24.04 LTS with QEMU, libvirt, virt-manager, bridge networking, and virsh command-line hypervisor management.

5 min read
Learn how to install KVM on Ubuntu 24.04 LTS with QEMU, libvirt, virt-manager, bridge networking, and virsh command-line hypervisor management.
- Prerequisites and Supported Releases
- Step 1: Checking Hardware Virtualization Support on Your Host CPU
- Step 2: Installing KVM, QEMU, Libvirt, and Virtualization Tools
Enterprise cloud infrastructure, automated CI/CD staging environments, and home-lab virtualization require reliable, bare-metal hypervisor performance. When you install kvm on ubuntu 24.04, you convert the Linux kernel directly into a Type-1 hypervisor that delivers near-native compute speeds, minimal host virtualization overhead, and seamless integration with Linux kernel scheduling.
Unlike hosted Type-2 hypervisors, KVM leverages CPU hardware extensions directly through the Linux kernel. Paired with QEMU hardware emulation, libvirt management APIs, and tools like virt-manager and virsh, KVM provides a modular and robust open-source virtualization platform. This guide covers prerequisite validation, package deployment, permissions management, virtual bridge networking, and virtual machine provisioning.
Kernel-based Virtual Machine (KVM) turns your Ubuntu server or workstation into a high-performance Type-1 hypervisor. This comprehensive guide walks you through how to install KVM on Ubuntu 24.04 LTS, verify CPU hardware virtualization extensions, configure QEMU and libvirt, manage virtual machines via CLI and GUI (virt-manager), and configure bridge networking.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A dedicated server, cloud bare-metal instance, or workstation running Ubuntu 24.04 LTS.
- An x86-64 processor equipped with Intel VT-x or AMD-V hardware virtualization support.
- A user account with active sudo administrative privileges.
- At least 4 GB of system RAM (8 GB or more recommended for hosting concurrent guest virtual machines).
Step 1: Checking Hardware Virtualization Support on Your Host CPU
If the output reports KVM acceleration can be used, your processor is ready. If it displays an error indicating that virtualization is disabled, restart your machine, enter the BIOS/UEFI setup screen, and enable Intel VT-x or AMD SVM.
# Install the cpu-checker utility
sudo apt update
sudo apt install -y cpu-checker
# Run the KVM compatibility check
kvm-ok
# Expected successful output:
# INFO: /dev/kvm exists
# KVM acceleration can be used
Step 2: Installing KVM, QEMU, Libvirt, and Virtualization Tools
KVM operates as a collection of modular tools: KVM provides kernel-level CPU/memory virtualization, QEMU emulates peripheral hardware devices, and libvirt provides unified background daemon control.
Install the core hypervisor stack and management packages via APT.
# Install KVM, QEMU, libvirt daemon, bridge utilities, and client tools
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager
Core Virtualization Package Breakdown
Understanding each component ensures you can effectively troubleshoot and maintain your hypervisor stack:
Step 3: Verifying the libvirtd Daemon Service and Permissions
The libvirtd service manages virtual machine processes, virtual networking bridges, and storage pools. Ensure that the daemon is enabled and running.
Add your administrative user account to the libvirt and kvm groups so you can manage virtual machines without invoking sudo on every command.
# Verify the active status of libvirtd
sudo systemctl status libvirtd
# Ensure libvirtd starts automatically upon boot
sudo systemctl enable --now libvirtd
# Add your current user to the libvirt and kvm groups
sudo usermod -aG libvirt,kvm $USER
# Apply the new group memberships to your active session
newgrp libvirt
Step 4: Configuring Default NAT Virtual Networking
Libvirt creates a default virtual network switch named default backed by a private NAT subnet (typically 192.168.122.0/24 on the virbr0 bridge device).
Verify that the default network is active and set to autostart upon host boot.
# List all libvirt networks
virsh net-list --all
# If the default network is inactive, start and enable autostart
virsh net-start default
virsh net-autostart default
# Inspect the network configuration
virsh net-info default
Step 5: Creating Your First Virtual Machine via CLI (virt-install)
The virt-install utility provides an automated, headless method for provisioning virtual machines directly from the command line. This is ideal for remote servers without graphical desktop environments.
Download an Ubuntu 24.04 server ISO image to your storage directory and create a virtual machine named ubuntu-server-vm.
# Download the Ubuntu 24.04 LTS server ISO
sudo wget -P /var/lib/libvirt/images/ https://releases.ubuntu.com/24.04/ubuntu-24.04-live-server-amd64.iso
# Provision a new virtual machine with 2 vCPUs, 4 GB RAM, and 20 GB disk
sudo virt-install \
--name=ubuntu-server-vm \
--vcpus=2 \
--memory=4096 \
--cdrom=/var/lib/libvirt/images/ubuntu-24.04-live-server-amd64.iso \
--disk path=/var/lib/libvirt/images/ubuntu-server-vm.qcow2,size=20,bus=virtio,format=qcow2 \
--os-variant=ubuntu24.04 \
--network network=default,model=virtio \
--graphics none \
--console pty,target_type=serial \
--extra-args 'console=ttyS0,115200n8 serial'
Step 6: Managing Virtual Machines with virsh
The virsh command-line utility provides comprehensive controls to start, pause, inspect, shut down, and delete virtual machines on KVM hosts.
Review the essential administrative commands below:
# List all running and inactive virtual machines
virsh list --all
# Start a stopped virtual machine
virsh start ubuntu-server-vm
# Connect to the guest serial console
virsh console ubuntu-server-vm
# Gracefully shut down a virtual machine via ACPI
virsh shutdown ubuntu-server-vm
# Forcefully power off an unresponsive virtual machine
virsh destroy ubuntu-server-vm
# Undefine and delete a virtual machine along with its storage
virsh undefine ubuntu-server-vm --remove-all-storage
Step 7: Graphical Management Using Virtual Machine Manager (virt-manager)
In the graphical window, click File > New Virtual Machine. The wizard allows you to select local ISO media, configure virtual CPUs and memory sliders, choose storage formats, and inspect live graphical guest monitors using SPICE or VNC.
Virt-manager also excels at managing remote headless hypervisors over SSH. By selecting File > Add Connection and specifying qemu+ssh://user@remote-hypervisor/system, system administrators can manage enterprise servers located in data centers without installing a heavy desktop environment on the remote host.
# Launch Virtual Machine Manager
virt-manager &
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied.
Cause: The current user account is not a member of the libvirt group, or the active shell session has not reloaded group memberships.
Resolution: Add the user to the libvirt group and re-authenticate your shell session.
sudo usermod -aG libvirt $USER && newgrp libvirt
virt-install: 'os-variant ubuntu24.04 is not supported'.
Cause: The local osinfo-db hardware database is outdated and lacks definitions for Ubuntu 24.04.
Resolution: Update the osinfo database using APT or substitute with --os-variant=ubuntu22.04.
sudo apt update && sudo apt install -y osinfo-db
Guest virtual machines have no Internet connectivity.
Cause: The default libvirt NAT bridge (virbr0) is not active or host IP forwarding is disabled.
Resolution: Start the default network and enable IPv4 packet forwarding in /etc/sysctl.conf.
virsh net-start default && sudo sysctl -w net.ipv4.ip_forward=1
Security Best Practices and Hardening
Isolate guest virtual machine network traffic using dedicated VLANs or restricted virtual bridge networks.
Do not expose QEMU VNC or SPICE graphical consoles on public IP addresses; tunnel graphical display sessions through secure SSH connections.
Keep hypervisor storage pools isolated with strict Unix permissions (chmod 700 /var/lib/libvirt/images) to prevent unauthorized access to virtual disk images.
Enable AppArmor or SELinux profiles for libvirt (sVirt) to enforce kernel-level process confinement between untrusted virtual machine instances.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install VirtualBox on Ubuntu 24.04 — Compare native KVM hypervisor performance with VirtualBox Type-2 virtualization.
- How to Install VMware Workstation Player on Ubuntu 24.04 — Explore VMware Workstation setup and kernel module compilation on Ubuntu 24.04.
- How to Configure Networking with Netplan on Ubuntu — Configure host network bridges in Netplan for direct virtual machine LAN assignment.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
options kvm_intel nested=1 in /etc/modprobe.d/kvm.conf.virsh console session back to your host terminal, press Ctrl+].Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides
Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!