---
title: "How to Install KVM on AlmaLinux — Step-by-Step Guide"
source: "https://docs.nexcess.com/hosting/server-administration/linux/install-kvm-on-linux-almalinux/"
description: "Install KVM on AlmaLinux 8. A step-by-step tutorial on libvirt setup, network bridging, and using virt-install to create your first virtual machine."
vertical: "Hosting"
date: "2023-12-29"
last_modified: "2026-07-29"
---

# How to Install KVM on AlmaLinux — Step-by-Step Guide

## Introduction

Virtualization unlocks the power to run multiple operating systems on one physical server, saving costs and maximizing efficiency. On AlmaLinux, the **Kernel-based Virtual Machine (KVM)** provides a stable, open-source virtualization platform that transforms your server into a flexible environment for running virtual machines (VMs).

---

## Prerequisites 

Before you begin, make sure your system meets the following requirements:

- **Operating system:** AlmaLinux OS 8
- **CPU:** Intel VT-x or AMD-V enabled (hardware virtualization support)
- **RAM:** At least 4 GB (more recommended for multiple VMs)
- **Disk space:** Minimum 20 GB free for VM images

---

## Step-by-Step Instructions

1. Run the following command to check if your CPU supports virtualization.

```
<br></br>egrep -c '(vmx|svm)' /proc/cpuinfo<br></br>
```

2. Update AlmaLinux by running the following command:

```
<br></br>sudo dnf update<br></br>
```

3. Install KVM, Libvirt, and related administration utilities

```
sudo dnf install qemu-kvm libvirt libvirt-client virt-top virt-install virt-manager virt-viewer libguestfs-tools
```

4. Activate the libvirt service to manage your virtual machines:

```
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
```

5. Configure a bridge interface by editing the interface file. This allows your virtual machines to communicate externally. First, open the ifcfg-br0 configuration file:

```
sudo nano /etc/sysconfig/network-scripts/ifcfg-br0<br></br>
```

6. Add the following values, matching the values your network’s current configuration:

```
DEVICE=br0
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
IPADDR=<your_bridge_ip>
NETMASK=<your_netmask>
GATEWAY=<your_gateway>
DNS1=<your_primary_dns>
DNS2=<your_secondary_dns>
```

Configuration Values

- **DEVICE=br0**: This specifies the name of the network interface. **br0** is a common and conventional name for a bridge interface.
- **TYPE=Bridge**: This clearly identifies the interface type as a **bridge**, which is used to connect multiple network segments together.
- **BOOTPROTO=none**: This setting indicates that the network interface will not obtain an IP address automatically via protocols like DHCP. Instead, it will use a static IP address, which is defined by the following lines.
- **ONBOOT=yes**: This ensures that the bridge interface is activated automatically when the system starts up.
- **IPADDR=<your\_bridge\_ip>**: This is where you enter the **static IP address** you want to assign to the bridge. This IP address allows the host machine to communicate on the network through the bridge.
- **NETMASK=<your\_netmask>**: The **netmask** defines the network portion of the IP address, which is essential for routing traffic correctly within the local network.
- **GATEWAY=<your\_gateway>**: The **gateway** is the IP address of the router that allows traffic to leave the local network and reach the internet.
- **DNS1=<your\_primary\_dns>** and **DNS2=<your\_secondary\_dns>**: These are the IP addresses of the **Domain Name System (DNS)** servers that the system will use to resolve domain names to IP addresses.

7. Edit your Ethernet interface file by opening the following file:

```

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

```

8. Add or modify to following configurations:

```

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BRIDGE=br0

```

9. Restart the network service:

```

sudo systemctl restart network

```

You are now ready to create your own virtual machine! Create a virtual machine with the AlmaLinux 8.4 ISO, by running:

```
sudo virt-install --name your_virtual_machine_name--ram=2048 --vcpus=2 --cpu host --hvm 

--disk path=/var/lib/libvirt/images/almalinuxservervml,size=20 

--cdrom /var/lib/libvirt/boot/AlmaLinux-8.4-x86_64-DVD.iso --graphics vnc
```

**– TIP –**

**Key virt-install options explained:**

- –name: A unique identifier of your virtual machine
- –ram: Memory allocation in MB
- –vcpus: Virtual CPUs
- –disk: Disk size and location
- –cdrom: Path to ISO file
- –graphics vnc: Enables graphical console

11. Find your VNC display port:

```
sudo virsh domdisplay your_virtual_machine_name
```

12. After completing the AlmaLinux installation, you can verify the virtual machine’s status by listing all machines (active and inactive) with this command:

```
 sudo virsh list --all
```

## Update the KVM

1. Update the KVM and any related packages, by running the following command:

```
sudo dnf update qemu-kvm libvirt libvirt-client virt-top virt-install virt-manager virt-viewer libguestfs-tools
```

## Uninstall or remove the KVM

1. Uninstall the KVM and related packages, by running the following commands:

```
<br></br>sudo dnf remove qemu-kvm libvirt libvirt-client virt-top virt-install virt-manager virt-viewer libguestfs-tools
```

**Frequently asked questions**

****My Virtual Machine cannot connect to the internet.****Double-check your bridge network configuration (ifcfg-br0 and ifcfg-eth0).If that doesn’t work, try restarting the network service after editing the configuration file.

****virt-install command fails with “no bootable device.”****Ensure the ISO path is correct and accessible under /var/lib/libvirt/boot/.

****VNC viewer won’t connect.****Make sure firewall rules allow the VNC port (5900 + display number).

## Managing your Virtual Machine After Installation

Want to learn more about managing your virtual machine? Check out our article on [Managing your virtual machine with Virsh.](https://docs.nexcess.com/hosting/server-administration/linux/managing-virtual-machines-with-virsh/)

You can access the Virtual Machine console via:

```
sudo virt-viewer AlmaLinux-server
```

Or manage it graphically with **Virt-Manager**:

```
sudo virt-manager
```

This command will pop open the Virtual Machine Manager interface as shown:

![](https://docs.nexcess.com/wp-content/uploads/2026/06/image-1.png)---

With KVM installed and your first Virtual Machine running, your AlmaLinux server has transformed into a full-fledged virtualization host—ready to handle multiple workloads, test environments, or production servers.

## Official documentation: 

- https://origin.kernel.org/doc/html/latest/virt/kvm/api.html
