Exercise: KVM Installation and Check
Preparing the Host for Virtualization
1 Purpose
Before you can create and run virtual machines, you must ensure your host system has the necessary hardware support and that the core virtualization software is installed. This exercise walks you through checking your CPU for virtualization extensions and installing the standard KVM/QEMU hypervisor stack and management tools on your Fedora system.
2 What You’ll Accomplish
By the end of this exercise, you will be able to:
- Use
lscputo verify your processor supports hardware virtualization. - Install the KVM, QEMU, and
virt-managerpackages. - Enable and check the status of the
libvirtdservice, which manages VMs.
This exercise maps to the following program and course learning outcomes:
- Course Learning Outcomes (CLOs):
- 1. Identify hardware and basic network components: You will verify a critical CPU hardware feature (virtualization extensions) and install the software components that make up a hypervisor.
This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.
| Learning Objective | O*NET KSAs | Technologies Used |
|---|---|---|
| Verify hardware support for virtualization. | Knowledge: Computers & Electronics Skills: None |
lscpu, VT-x, AMD-V |
| Install and enable virtualization services. | Knowledge: Computers & Electronics Skills: Systems Analysis |
KVM, QEMU, libvirtd |
3 Prerequisites
This exercise requires a running Fedora 42 virtual machine with sudo privileges. Note that for this exercise to succeed, your physical machine’s BIOS/UEFI must have virtualization extensions (Intel VT-x or AMD-V) enabled.
4 Step-by-Step Guide
Open a terminal window in your Fedora VM to begin.
4.1 Step 1: Check for Hardware Virtualization Support
The lscpu command displays detailed information about the CPU architecture. We can search its output for virtualization support.
Run the following command:
lscpu | grep -i 'virtualization'Analyze the Output: You should see a line that says
Virtualization:followed byVT-x(for Intel) orAMD-V(for AMD). If you see this, your CPU supports hardware virtualization. If there is no output, you may need to shut down your physical machine and enable the setting in its BIOS/UEFI.
4.2 Step 2: Install Virtualization Packages
Fedora provides a package group that bundles all the necessary tools for virtualization.
Run the
dnf groupinstallcommand. The--with-optionalflag is recommended to include useful tools likevirt-manager.sudo dnf groupinstall --with-optional virtualizationThis will install QEMU (the machine emulator), KVM (the kernel hypervisor module),
libvirt(the management library), andvirt-manager(the graphical management tool).
4.3 Step 3: Start and Enable the Virtualization Service
The libvirtd service is the daemon that manages your VMs. You need to start it and enable it to launch automatically on boot.
Run the
systemctlcommand to start and enable the service:sudo systemctl enable --now libvirtdThe
--nowflag both enables and starts the service in a single command.
4.4 Step 4: Verify the Service Status
Finally, check that the libvirtd service is running correctly.
Run the status command:
sudo systemctl status libvirtdAnalyze the Output: You should see a line that says
Active: active (running)in green text. This confirms that your host is now ready to create and manage virtual machines. Pressqto exit the status view.
5 Reflect and Review
Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:
- 3 key software components you installed.
- 2
systemctlcommands you used. - 1 question you still have about KVM or QEMU.
Answer these questions in your notebook to solidify your understanding:
- What command do you use to check if your CPU supports virtualization?
- What is the name of the primary service daemon that manages virtual machines on Fedora?
- What does the
--nowflag do in thesystemctl enable --nowcommand? - If
lscpudoes not show virtualization support, what is the most likely place to fix this?