How to Configure and Install KVM on Debian 11 Bullseye Linux – Guide

here is a guide to learn the steps to download and install KVM Hypervisor Virtualization server on Debian 11 | 10. KVM (Kernel-based Virtual Machine) is a complete open source virtualization solution for Linux systems running on x86 hardware with virtualization extensions (Intel VT or AMD-V). KVM needs you to have the CPU on your computer that has a feature Intel VT or AMD-V. KVM consists of a loadable kernel module, kvm.ko, which provides the core virtualization infrastructure and a processor-specific module, kvm-intel.ko or kvm-amd.ko.

Steps to install and enable KVM on Debian 11 Bullseye

The commands given below will work with Debian 10 Buster and Debian 11 Bullseye to set up Qemu KVM and run a virtual machine on it.

1. Confirm virtualization support

As in the beginning, I said, we need a system with an Intel or AMD process that has the virtualization extension enabled. So, to confirm this, on your Debian 11, open the command terminal and run the given commands: As you run the above commands to confirm whether virtualization is enabled or not, the output will be greater than zero. And if not, you first need to reboot the system and enter the system BIOS. Enable virtualization and then boot into the OS where again run the above command to confirm the same. The output of the first command will be greater than zero, that means it can be 1, 2, 6 or 8. Therefore, the system supports virtualization. Using the second command you will get information about your CPU – either Intel or AMD. If the red color output text is VMX, it is Intel, while SVM means AMD.

2. Run system update

If you have already run the update command, skip this step, otherwise run it once before proceeding to update installed packages and rebuild the repository cache.

3. Command to install QEMU-KVM & Libvirt on Debian 11 Bullseye

Following is the key command of this tutorial which will download and install everything needed to install Qemu, KVM hypervisor and Libvirt on Debian 11 Linux.

4. Virt-Manager GUI for KVM

Those using the Graphical Debian 11 Desktop can also install Virt-Manager, a graphical user interface developed by RedHat to create, manage and run virtual machines using KVM, but graphically.

5. Make the network active and restart automatically

To list the network available for use on KVM virtual machines, run the following command: However, on output you will see that the default network is not active and it is also not configured to automatically start on system reboot. Therefore, to make it active and start automatically, run the following commands: You can check the network again.

6. Add “vhost_net”

To improve network data transfer performance and reduce virtio-net load, we can add the kernel module vhost_net ” to our Debian 11 Linux using the command given below: vhost-net is the backend (host side) while virtio-net (guest side) is the frontend running in the guest kernel space. To learn more about them, see: Vhost-net & Virtio-networking To check if it has been activated:

7. Create a bridge network (optional)

Although KVM comes with a bridging network interface called “virbr0 ″ configured out of the box, however this does not allow us to access the KVM virtual machine outside the host PC using some other computer on the network due to the IP range assigned by this . Therefore, we will create our own full bridge interface over the physical nic of the host system which will have the IP range of our network. Find the physical network interface connected to the host system that you want to use for the bridge. You will see all network interfaces connected on your host machine. Now make a note of the one you want to use for the Bridge network. For example, here we have enps03 and the IP address is 192.168.0.109. Therefore, the range is between 192.168.0.1-192.168.0.255 Now edit your Debian 11 network interface file: Add the following lines: Note: Change the yellow values ​​according to your network Save the file by pressing Ctrl + O, press the Enter key and exit using Ctrl + X. or Note: If you want the bridge to obtain an IP address using DHCP: So instead of the above settings, use this: Restart Network Manager to apply the changes.

Bridge setupiface br0 inet dhcpbridge_ports enp0s3

Check the IP address or sudo /etc/init.d/networking restart this time, you will see your newly created br0 bridge interface, along with others.

8. Create virtual machines using Virt-Manager GUI

Anyone who wants to use Virt’s command line to create virtual machines and run using KVM just follow the link. Since if you are using the GUI, Debian 11 Desktop can use Virt-Manager. To get an idea here is a glimpse… Run Virt-Manager: Go to Application Launcher, look for “Virtual Machine Manager” (VVM) and run it. Before opening, the system will ask for the root password. This will allow him to create and manage virtual machines. Create virtual machines: Click PC icon to create a new virtual machine in Virt-Manager using KVM. Locate the Media ISO Volume: Click Browse button and locate the ISO file you want to use to install an operating system on your virtual machine as a guest operating system. After that, uncheck the box “Automatically detect from installation media / source” and click the Next button button. Choose memory and CPU settings: Set the amount of virtual memory you want to assign to the VM and then the number of CPU cores. Create Qemu Virtual Disk Image: To install the VM guest OS we need some storage space and for that we have to create a disk image file. Just enter the amount of hard drive space you want to allocate and move on. Network: Name your virtual machine here. Also, by default, Virt-manager will use NAT, however, you can select the Bridge interface or the default interface, ie vibr0, or the one you created. If you don’t know about these settings, let the default NAT be selected. Qemu KVM virtual machine on Debian 11 Bullseye: Finally, you will have a booted virtual machine that can be controlled like any physical computer using a keyboard and mouse.

Final note

I hope you like the guide How to Configure and Install KVM on Debian 11 Bullseye Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.

How to Configure and Install KVM on Debian 11 Bullseye Linux  2022  - 62How to Configure and Install KVM on Debian 11 Bullseye Linux  2022  - 32How to Configure and Install KVM on Debian 11 Bullseye Linux  2022  - 29How to Configure and Install KVM on Debian 11 Bullseye Linux  2022  - 91