Menu
ZacsTech
  • Home
  • Linux
  • Windows
  • How To
  • Resources
  • Contact Us
ZacsTech
QEMU/KVM and Virt-Manager on Ubuntu 22.04

How to Install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS

Posted on August 26, 2023August 26, 2023

Virtualization is an essential tool for developers, IT professionals, and even tech enthusiasts. It enables users to simulate multiple computer systems on a single physical machine, thereby allowing for testing, development, and even server consolidation.

Qemu/KVM and Virt-Manager are two key pieces in the Linux virtualization puzzle.

Qemu/KVM (Kernel-based Virtual Machine) is a combination of two components:

  1. QEMU is a generic and open-source machine emulator and virtualizer. It can run OSes and programs made for one machine (e.g., an ARM board) on a different machine (e.g., an x86 PC).
  2. KVM is a Linux kernel module that allows the host machine to exploit the virtualization capabilities of modern processors, making the virtualization faster and more efficient.

While Qemu/KVM provides the underlying virtualization engine, managing virtual machines (VMs) through command-line can be daunting for many users.

That’s where Virt-Manager comes into play. Virt-Manager, short for “Virtual Machine Manager”, is a graphical user interface that makes managing VMs on QEMU/KVM simpler and more intuitive.

The combination of QEMU/KVM for robust virtualization and Virt-Manager for easy management creates a compelling virtualization solution suitable for both professional and personal applications.

Prerequisites:

Before delving into the installation process of Qemu/KVM and Virt-Manager on Ubuntu 22.04 LTS, certain prerequisites must be met to ensure a seamless and effective setup.

Firstly, you should be running on an Ubuntu 22.04 LTS system, which provides the latest security and feature updates tailored for long-term stability.

Additionally, the computer’s CPU needs to support hardware virtualization; most modern processors do, but this can be verified by checking for the presence of ‘vmx’ (for Intel CPUs) or ‘svm’ (for AMD CPUs) flags using the egrep -c '(vmx|svm)' /proc/cpuinfo command.

A non-zero output indicates that hardware virtualization is supported. Furthermore, the installation and configuration process will require certain administrative tasks. Hence, the user should possess sudo privileges, granting them the ability to execute commands with administrative rights.

Meeting these prerequisites not only guarantees that the software components can be installed, but it also ensures that they will operate with maximum efficiency and stability.

Steps:

The installation of Qemu/KVM and Virt-Manager on Ubuntu 22.04 LTS can be broken down into a systematic procedure. Here are the detailed steps:

1. Update the System:

To ensure that you have the latest updates and packages, begin by updating your system:

 sudo apt update && sudo apt upgrade -y 

update: When used with apt, it updates the list of available packages and their versions, but it does not install or upgrade any packages. Essentially, it refreshes the local database of available packages from the repositories defined in /etc/apt/sources.list and /etc/apt/sources.list.d/.

upgrade: When used with apt, it installs the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list and /etc/apt/sources.list.d/. New packages will be installed if required to satisfy dependencies, but existing packages will never be removed.

2. Install QEMU/KVM on Ubuntu 22.04

Install QEMU/KVM  by running this command

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

The command you provided installs a set of packages that are commonly used for setting up and managing virtual machines on Debian-based Linux distributions using QEMU and KVM. Let’s break down the command and its components:

  1. sudo: This stands for “superuser do”. It allows permitted users to execute a command as the superuser or another user. Running package installations typically requires superuser privileges.
  2. apt: This is the package handling utility (Advanced Package Tool) for Debian-based systems.
  3. install: When used with apt, it specifies that you want to install the following packages.
  4. The packages:
    • qemu-kvm: This is the main package for QEMU with KVM support. QEMU is a generic and open source machine emulator and virtualizer. KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions. Together, they allow for efficient virtualization on modern hardware.
    • libvirt-clients: This package contains client-side utilities and applications to manage the virtualization capabilities of libvirt. Libvirt is an open-source API, daemon, and management tool for managing platform virtualization.
    • libvirt-daemon-system: This installs the libvirt daemon and its related components, enabling you to manage virtual machines as a system service.
    • bridge-utils: This package provides utilities for configuring the Linux Ethernet bridge. It’s useful for creating a network bridge for virtual machines to communicate with the host system and other VMs.
    • virtinst: This is a set of command-line tools for creating virtual machines. One of its commonly used tools is virt-install.
    • libvirt-daemon: This is a transitional package which ensures that the appropriate libvirt daemon is installed.

When you run this command, your system will install all of the mentioned packages, which collectively will enable you to set up, run, and manage virtual machines using QEMU/KVM and libvirt. If you’re planning on using virtualization, this set of tools is quite powerful and versatile.

3. Start and Enable the libvirtd Virtualization daemon.

Run the following commands to start the service.

sudo systemctl enable –now libvirtd sudo systemctl start libvirtd

The two commands provided involve systemctl, which is a utility for controlling the systemd system and service manager. They specifically interact with the libvirtd service, which is the daemon for the libvirt virtualization API.

The first command (sudo systemctl enable --now libvirtd) both enables the libvirtd service to start on system boot and starts it immediately. The second command (sudo systemctl start libvirtd) would just start the service immediately. If executed in sequence as you provided, the second command wouldn’t have any additional effect since the service is already started by the first command.

You can also check the virtualization service by running this command

  sudo systemctl status libvirtd  

How to Install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS
How to Install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS

4. Install Virt-Manager GUI 

Run this command to install the GUI.

 sudo apt install virt-manager 

virt-manager (Virtual Machine Manager) is a desktop user interface for managing virtual machines through libvirt. Essentially, it provides a graphical interface to interact with KVM/QEMU virtual machines, allowing you to create, edit, start, and stop virtual machines, as well as manage their resources and configurations.

It’s a popular tool among those who prefer a GUI for VM management over command-line tools. Once installed, you can launch virt-manager, and it will communicate with the libvirtd service to manage your virtual machines.

5. Add Logged in User to the KVM and Libvirt Group

To add the logged in user to the KVM and Libvirt Groups run the following commands

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

These commands modify the group membership of a user on a Linux system, specifically adding the user to the kvm and libvirt groups, respectively.

6. Lauch the Virtual Machine Manager

Launch the Virtual Machine Manager GUI with superuser (root) privileges by running this command. You can also launch it from the applications menu.

sudo apt install virt-manager

However, it’s worth noting that, in many setups, if you’ve added your user to the libvirt group (as discussed above), you often don’t need to run virt-manager with sudo because being in the libvirt group provides the necessary permissions to manage virtual machines without superuser rights.

How to Install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS

 

7.  Create Virtual Machine

Virt-Manager Ubuntu 22.04

Once QEMU/KVM and Virt-Manager are installed on an Ubuntu system, creating a new virtual machine becomes a straightforward and user-friendly process.

To begin, launch Virt-Manager either from the applications menu or by typing virt-manager in the terminal. In the Virt-Manager window, click on the “Create a new virtual machine” button, typically represented by a computer icon with a green plus sign.

This action initiates the New VM wizard. Here, you can choose to install from an ISO image, a CD/DVD, a network boot, or even clone an existing VM. For most users, selecting an ISO image of the desired operating system is the common choice.

After selecting your installation source, the wizard will guide you through configuring the VM’s resources, such as allocated memory, CPU cores, and disk space.

Once the desired settings are in place, the virtual machine will be created and appear in Virt-Manager’s list of VMs. From this list, you can start, stop, clone, or even delete virtual machines as needed.

The intuitive interface of Virt-Manager paired with the power of QEMU/KVM makes creating and managing virtual machines on Ubuntu both efficient and accessible.

Video: How to Install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS

You can check out this video on our YouTube channel on how to install QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS

Conclusion

You’ve now successfully installed and set up QEMU/KVM and Virt-Manager on Ubuntu 22.04 LTS. With these tools in place, you’re ready to create and manage virtual machines on your Ubuntu system. Enjoy the flexibility and power of virtualization!

 

 

 

 

 

Related posts:

How to Speed up File Transfer to USB Flash Drive How To Create a Steam AccountHow To Create a Steam Account in 2023 Atom Text Editor on UbuntuHow to Install Atom Text Editor on Ubuntu 22.04 LTS How to Use SCP Command to Transfer FilesHow to Use SCP Command to Transfer Files Securely

Leave a Reply Cancel reply

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

  • facebook
  • twitter
  • pinterest
Privacy Policy
Terms and Conditions

Contact Us
About Us
©2025 ZacsTech | Powered by SuperbThemes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT