Skip to content
Follow
Ubuntu Linux

How to Install KVM on Ubuntu 24.04

Richard
Written by
Richard
Dec 16, 2024 Updated Oct 11, 2026 6 min read
How to Install KVM on Ubuntu 24.04
How to Install KVM on Ubuntu 24.04

KVM (Kernel-based Virtual Machine) is a built-in Linux feature that turns Ubuntu into a hypervisor. It lets Ubuntu 24.04 run several virtual machines (VMs) directly on your hardware. Each guest operating system runs separately, and the Linux kernel does the work. You don’t need VirtualBox or VMware.

Advertisement

You can manage your VMs with a graphical tool such as virt-manager, or from the terminal with utilities such as virt-install. Both give you hardware acceleration and direct control over the CPU, memory and disk each VM gets.

⚡ Quick Answer

Install KVM on Ubuntu by first running sudo apt install cpu-checker and sudo kvm-ok to confirm your CPU supports virtualization, then running sudo apt install qemu-kvm virt-manager libvirt-clients bridge-utils libvirt-daemon-system virtinst. The same steps work on Ubuntu 20.04, 22.04 and 24.04.

Advertisement

Check KVM Support on Ubuntu

📝Good to KnowBefore you install anything, check that your machine can run KVM.

You need a processor with hardware virtualization (Intel VT-x or AMD-V). You also need the cpu-checker package, which provides the kvm-ok command. The check tells you whether the system can run virtual machines at all. The steps are the same on Ubuntu 20.04, 22.04 and 24.04.

Install the verification tool, then run the check:

  1. Open a terminal.
  2. Run the install command below to get cpu-checker.
  3. Run the kvm-ok command from the same block to test your CPU.

The first command needs administrator rights, so you will be asked for your password. Nothing shows while you type it. That is normal.

🐧Bash / Shell
sudo apt install cpu-checker
sudo kvm-ok

A successful check ends with the message ‘KVM acceleration can be used.’ If you see it, your CPU supports virtualization and it is switched on. You can continue to the installation.

Advertisement
💻Code
INFO: /dev/kvm exists
KVM acceleration can be used

If KVM can't run on your system, you'll see a message like the one below:

💻Code
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

This message means KVM cannot run on your system as it is. There are two common causes:

  • The CPU does not support hardware virtualization. In that case KVM is not an option on this machine.
  • Virtualization is turned off in the BIOS/UEFI. Restart the computer, enter the firmware setup, and look for an option named something like Intel Virtualization Technology, VT-x or SVM Mode. Turn it on, save, boot back into Ubuntu and run the check again. The exact name and location differ between manufacturers.
📝Good to KnowIf Ubuntu itself runs inside a virtual machine, the host must pass virtualization through to it (nested virtualization).

Otherwise the check will fail there too.

Install KVM Packages

Next, install the KVM packages with the apt install command. The packages you need are:

Advertisement
  • qemu-kvm, the emulator and hypervisor component
  • virt-manager, the graphical tool for managing VMs
  • libvirt-clients, the command-line client tools
  • bridge-utils, for network bridging
  • libvirt-daemon-system, the background service that manages VMs
  • virtinst, which provides virt-install

Together these give you the core hypervisor and the graphical interface. To install them:

  1. Run the install command in the block below.
  2. Type your password if asked, and confirm when apt asks whether to continue.
  3. Wait for the downloads and setup to finish and the prompt to return.

The download can be a few hundred megabytes, depending on what is already on your system. No restart is needed at this stage.

🐧Bash / Shell
sudo apt update
sudo apt install qemu-kvm virt-manager libvirt-clients bridge-utils libvirt-daemon-system virtinst

After the packages are installed, start the KVM services and set them to start automatically at boot:

  1. Run the start command in the block below.
  2. Run the enable command so the service launches every time the system boots.

If you only run the start command, the service stops working after a reboot. That is why you need the enable command as well. On a default Ubuntu install, the service may already be running after the package install. Running the commands again does no harm.

Advertisement
🐧Bash / Shell
sudo systemctl start libvirtd
sudo systemctl enable libvirtd

Add a User to libvirt and KVM Groups

To manage VMs without typing administrator credentials every time, add your user account to the 'libvirt' and 'kvm' groups. Without this, virt-manager may refuse to connect or ask for a password repeatedly.

To add your account to these groups:

  1. Run the command in the block below from your own user account.
  2. Log out of Ubuntu and log back in. Group changes only apply to new login sessions. A full restart works too.

If virt-manager still can't connect after you log back in, the group change has probably not taken effect. Log out fully and try again.

🐧Bash / Shell
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER

Create New VMs

With everything installed, you can create your first VM in Virtual Machine Manager. You open the tool, connect to the local server, click New Virtual Machine, and follow the wizard. Have an installation ISO for the guest operating system downloaded before you start. This example installs Ubuntu.

Advertisement

Start by connecting to the local server and opening the new VM wizard:

  1. Open Virtual Machine Manager from the Ubuntu application menu.
  2. Connect to the local server if it is not already connected. It is usually listed as QEMU/KVM.
  3. Click New Virtual Machine. The wizard opens and asks how you want to install the operating system.
KVM desktop dashboard
KVM desktop dashboard

Next, choose how to install the guest machine. The two options covered here are:

  • Local install media (ISO image or CDROM): use an ISO file, which is a disk image file you downloaded.
  • Network Install or Network Boot (PXE): install over the network. PXE is the preboot execution environment, which lets a machine boot from the network.

For most people the ISO option is the simplest. Pick your option and click Forward.

KVM installation wizard interface for creating a VM
KVM installation wizard interface for creating a VM

Now select the OS file and set up the VM's resources:

Advertisement
  1. Click Browse and select your ISO file.
  2. If the wizard does not detect the operating system, search for it by name in the OS field and choose the closest match.
  3. Click Forward, then set how much memory and how many CPUs the VM gets.
  4. Click Forward again and configure a local disk for the VM. Give it enough space for the guest system and your data.
  5. Click Forward to reach the summary page, where you can name the VM and review the additional hardware settings.

Don't give the VM more memory than your host can spare. Leave enough for Ubuntu itself, or both the host and the guest will slow down.

KVM installation wizard showing RAM allocation settings
KVM installation wizard showing RAM allocation settings

When the settings look right, click Finish. The VM boots from the ISO and the guest operating system's installer starts. Follow its prompts to install Ubuntu inside the VM, as you would on a physical computer.

KVM installation wizard boot options for virtual machines
KVM installation wizard boot options for virtual machines

That completes the installation. KVM is running, your account can manage it, and you have a working virtual machine. You can create more from the same wizard or with virt-install.

Conclusion:

  • KVM provides an efficient and powerful virtualization solution for Ubuntu 20.04 users, and the same steps work on Ubuntu 24.04.
  • It allows creating and managing multiple virtual machines, leveraging the Linux kernel's capabilities.
  • Users can choose from various installation sources, including local ISOs and network installations.
  • Adding user accounts to the appropriate groups ensures smooth management of virtual machines.
  • With tools like virt-manager, users can easily configure and monitor their virtual environments.
  • KVM is a robust alternative for users unable to utilize VirtualBox or VMware, emphasizing performance and integration with Linux systems.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

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