Oberst Server
How to Install KVM on Linux Fast (2026 Guide) Pro!

Are you interested in virtualizing Linux machines? Dann, installing KVM (Kernel-Based Virtual Machine) will certainly be useful for you. This quick and concise guide in 2026 will provide you with instructions on the easiest method of KVM installation without any extra moves and waste of time. Whether you are a software developer, administrator, or simply a person interested in virtualization, this guide will help you easily go through all the stages and successfully complete the task.

How to Install KVM?

How to Install KVM?

It is also possible to have just QEMU and KVM for an ultra-minimal installation, but for most people, the need for libvirt is imperative in configuring and managing the virtualization processes (libvirt-daemon-system – libvirt, virt-manager – GUI tool for libvirt). A typical installation process would involve installing the following:

$ sudo apt install qemu-system libvirt-daemon-system

If you are using a server for your installation, then you should use theno-install-recommends apt flag while installing so that unnecessary graphical software is not installed during the installation process.

$ sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system

Wordpress Hosting

WordPress-Webhosting

Ab 3,99 $/Monat

Jetzt kaufen

This daemon will automatically be started when the system starts up, and it will also automatically load the necessary KVM modules kvm-amd or kvm-intel modules, which are available with the Debian Linux Kernel. To work with virtual machines through the command line interface, you must install virtinst.

To control virtual machines with a regular user account, the user must belong to the libvirt group:

# adduser <youruser> libvirt

Then you must be able to list your domains – i.e., virtual machines under libvirt management:

# virsh list --all

User and System VMs

Typischerweise, if virsh is launched as an ordinary user, it uses the qemu:///session URI string to establish a connection with libvirt. In this way, only VMs associated with the user running virsh can be controlled. In order to manage system VMs (those VMs owned by root) we need to either launch virsh as root or specify the qemu:///system URI for our connection:

Cheap VPS

Günstiger VPS-Server

Ab 2,99 $/Monat

Jetzt kaufen

$ virsh --connect qemu:///system list --all

Alternativ, instead of specifying the URI every time we want to launch a virsh command, it can be defined within the LIBVIRT_DEFAULT_URI environment variable:

$ export LIBVIRT_DEFAULT_URI='qemu:///system'

Guest creation

One of the simplest methods to create and control a VM guest is through a GUI tool. Zum Beispiel:

  • AQEMU aqemu
  • Virtual Machine Manager virt-manager

Auf der anderen Seite, one can choose to create a guest from the command line interface using virt-install. The following is an example of creating a Bookworm guest calledbookworm-amd64“:

virt-install --virt-type kvm --name bookworm-amd64 \
--cdrom ~/iso/Debian/debian-12.0.0-amd64-netinst.iso \
--os-variant debian12 \
--disk size=10 --memory 1024

Windows VPS

Windows VPS-Hosting

Remote Access & Full Admin

Jetzt kaufen

Because your guest doesn’t have a network connection at this point, you’ll have to use the GUI virt-viewer to finish the installation process.

This method will prevent the need to download the ISO file by utilizing thelocation flag:

virt-install --virt-type kvm --name bookworm-amd64 \
--location https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/ \
--os-variant debian12 \
--disk size=10 --memory 1024

To install your system via the text console, you’ll have to make sure virt-install uses the serial console:

virt-install --virt-type kvm --name bookworm-amd64 \
--location https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/ \
--os-variant debian12 \
--disk size=10 --memory 1024 \
--graphics none \
--console pty,target_type=serial \
--extra-args "console=ttyS0"

For a fully automated install look into preseed or debootstrap.

Bridge Networking Setup

Standardmäßig, QEMU uses macvtap operating in VEPA mode to provide NATted access to the internet or a bridged environment where other guests are present. In this way, guests are able to access the internet (assuming there is an internet connection on the host machine) but will not be visible or accessible from the host machine or any other machine connected to the host’s LAN.

Default Network provided by Libvirt

The default network provided by Libvirt allows for communication between the host machine and guest machines. The default network is a NATted bridged network known asdefault.The default network is available only to the system domain VMs (this means VMs running as the root user or as the qemu:///system connection URI). VMs connected to the default network will be placed inside the 192.168.122.1/24 range and be provided with DHCP by dnsmasq. Default network is not started automatically. Verwenden:

virsh --connect=qemu:///system net-start default

In order to set up the default network to be started automatically, verwenden:

virsh --connect=qemu:///system net-autostart default

For this to work, it is necessary to install the recommended packages: dnsmasq-base, bridge-utils, and firewalld.

Accessing guests by hostnames

When the default network is set up, it is possible to configure the DNS server of libvirt dnsmasq, making it possible to access guests through their hostnames. It is useful when working with several guests and having to connect to them using a simpler hostname than remembering all the IP addresses.

Erste, the default network should be configured by running the command:

<domain name='libvirt' localOnly='yes'/>

libvirt refers to the domain name used for guest machines. You can change this value if needed, but avoid using “local” since it may interfere with mDNS. It’s also important to set hlocalOnly=’yesto ensure that requests within this domain are not forwarded to upstream servers, which helps prevent potential request loops.

After applying these settings, your network configuration should resemble something like the following:

<network connections='1'>
<name>default</name>
<uuid>66b33e64-713f-4323-b406-bc636c054af5</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:af:9f:2a'/>
<domain name='libvirt' localOnly='yes'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
</network>

You might need to restart your network service for the new settings to become active.

Nächste, assign hostnames to your virtual machines. Zum Beispiel, if you want to name a guest vm1, log into that VM and run:

sudo hostnamectl set-hostname vm1.libvirt

After that, adjust the host’s NetworkManager so it uses libvirt’s DNS and can properly resolve the VM hostnames. Start by enabling NetworkManager’s built-in dnsmasq. Um dies zu tun, create a file at /etc/NetworkManager/conf.d/libvirt_dns.conf with the following content:

[main]
dns=dnsmasq

Dann, configure the host’s dnsmasq to forward all DNS queries related to the libvirt domain to libvirt’s own dnsmasq instance. This is done by creating another configuration file at /etc/NetworkManager/dnsmasq.d/libvirt_dns.conf with the content below:

server=/libvirt/192.168.122.1

Here, libvirt represents the domain name defined in your libvirt network configuration. Make sure the IP address matches the one assigned to libvirt’s default network (refer to the ip section in your earlier network config).

Once everything is set, restart NetworkManager on the host:

sudo systemctl restart NetworkManager

After completing these steps, you should be able to connect to your virtual machines using their hostnames, wie zum Beispiel ssh vm1.libvirt.

Accessing host services from guests when using firewalld

In the default configuration, the virbr0 interface is assigned to the libvirt zone in firewalld.

firewall-cmd --permanent --zone=libvirt --get-description

This zone is configured with an ACCEPT policy, which allows traffic to be forwarded freely between interfaces in the zone. Jedoch, there is also a lower-priority reject rule that prevents direct access to host services unless they are explicitly permitted. Administrators can modify the allowed services list as needed.

The libvirt zone is specifically designed for virtual networks managed by libvirt. Standardmäßig, any new virtual network bridge created by libvirt is automatically added to this zone.

If you want your virtual machines to access specific services running on the host, you need to open the required ports in the libvirt zone. Zum Beispiel:

firewall-cmd --permanent --zone=libvirt --add-port=3142/tcp
systemctl restart firewalld.service

Manual bridging

To allow communication between the host and virtual machines, you can create a macvlan bridge on top of a dummy interface. After setting it up, configure your VMs to use the dummy0 (macvtap) interface in bridged mode.

modprobe dummy
ip link add dummy0 type dummy
ip link add link dummy0 macvlan0 type macvlan mode bridge
ifconfig dummy0 up
ifconfig macvlan0 192.168.1.2 broadcast 192.168.1.255 netmask 255.255.255.0 up

Communication between host, guests, and external network

If you want full connectivity between the host, virtuelle Maschinen, and the outside network, you can configure a bridge interface as described in QEMU documentation.

Zum Beispiel, ändern /etc/network/interfaces to attach your physical interface (z.B., eth0) to a bridge like br0. Einmal konfiguriert, wählen br0 as the network interface for your virtual machines.

Setting Up KVM on Linux the Smart Way

Installing KVM on Linux in 2026 is no longer a complicated or time-consuming task—especially if you follow a streamlined approach. With modern distributions offering built-in support for virtualization tools, you can get a fully functional KVM environment up and running in just a few steps.

From installing the required packages and enabling virtualization support to configuring networking and managing virtual machines, the entire process has become more user-friendly and efficient. Tools like libvirt and virt-manager make it even easier to control and monitor your virtual machines without dealing with unnecessary complexity.

In the end on How to Install KVM, KVM remains one of the most powerful and flexible virtualization solutions available on Linux. Whether you’re setting up a home lab, Testumgebungen, or running production workloads, mastering KVM gives you a reliable and high-performance foundation.

Teilen Sie diesen Beitrag

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert