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

KVM”, the abbreviation for “Kernel Virtual Machine” is the hypervisor of the Linux kernel. It is quite popular and used in enterprises for easily performing the virtualization of operating systems. Here in this tutorial, we learn the steps and commands to install and enable KVM Hypervisor on Debian 10 or 11 Bullseye Server or Desktop Linux.
Since 2007, KVM is an official kernel component, however, as compared to Xen,  the other open-source hypervisor, the history of KVM is less changeful and has only been steeply upward from the start. KVM is also the preferred hypervisor in OpenStack and is therefore widely used in the cloud.
What exactly is KVM?
KVM is primarily not a bare-metal hypervisor but is based on Linux. We can install using a few commands on any Linux operating system to convert and use it as a virtualization server. Thus, KVM is formally a type 2 hypervisor, which simply means that it runs in the non-privileged ring 3. However, for years the experts have been conducting a now historical discussion about whether KVM is a Type 1 hypervisor after all.
We can use it to run multiple Virtual machines together on the same machine, however, the host system must support and has an enabled Intel VT-x (virtualization technology extension) or AMD-V (AMD64 Virtualization Extension) in its respective process.
What do we need to follow this tutorial:
• A machine supporting virtualization
• Debian 11 Linux
• A user with sudo rights
• Internet connection
Also, KnowInstall VirtualBox in Debian 11 Bullseye
 
Contents
The below-given commands will work for both Debian 10 Buster and Debian 11 Bullseye to set up Qemu KVM and run a virtual machine on it.
As in the beginning, I said, we need a system with either Intel or AMD process having enabled Virtualization extension. Hence, to confirm that, on your Debian 11 open the command terminal and run the given commands:
As you run the above commands to confirm virtualization is enabled or not, the output will be more than zero. And if not then first you have to reboot your system and enter system BIOS. Enable the virtualization and then boot to OS where again the run the above command to confirm the same.
The first command output will be greater than zero, this means it could be 1, 2, 6, or 8. Hence, the system supports virtualization.
Using the second command you will get information about your CPU- whether it is Intel or AMD. If the red color output text is VMX then it is Intel whereas SVM means AMD.
Output:
Confirm virtualization is supported on Debian 11
 
If you already have run the update command then skip this step, otherwise run it once before moving further to update the installed packages and rebuild the repository cache.
 
Next is the key command of this tutorial which will download and install all the required for the installation of Qemu, KVM hypervisor, and Libvirt on Debian 11 Linux.
 
Those who are using 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.
 
To list the available network to use in KVM virtual machines, run the following command:
However, in the output, you will see the default network is not active and also not set to start automatically with a system reboot. Therefore, to make it active and autostart run the following commands:
You can check the network again…
Set KVM network Default
 
To improve the performance of network data transfer and reduce the load of virtio-net, we can add vhost_net” kernel module in our Debian 11 Linux using the below-given command:
vhost-net is the backend (host side) whereas virtio-net (guest side) is the frontend running in the guest kernel space. To know more about them see: Vhost-net & Virtio-networking
To check it has been enabled: 
 
—————————-This step is not Necessary Until you want it-———————————–
Although the KVM comes with a bridge network interface called “virbr0″ setup out of the box, however, that won’t let us access the KVM virtual machine out of the host PC using some other computer in the network because of the IP range assigned by it. Therefore, we will create our own full-bridge interface over the physical nic of the host system that will have the IP range of our network.
Find the physical network interface attached to your host system that you want to use for the bridge.
You will see all the attached network interfaces on your host machine. Now, note down the one which you want to use for the Bridge network.
For example, here we have enps03 and the IP address is 192.168.0.109. Hence, the range is between 192.168.0.1-192.168.0.255
Find Physical network interface
Now, Edit your Debian 11 Network interface file:
Add the following lines:
Note: Change the yellow values as per your network…
Bridge Static Debian 11
Save the file by pressing Ctrl+O, hit the Enter key, and exit using Ctrl+X.
or
Note: If you want the bridge to get an IP address using DHCP:
Then instead of the above settings use this one:
DHCP Settings for Bridge in Debian
 
Restart the Network manager to apply the changes.
Check the Ip-address
this time you will see your newly created br0 bridge interface along with others.
———————————————————————————————————————
 
Those who want to use the Virt command line to create virtual machines and run using KVM just follow the link.
Whereas if you are using GUI Debian 11 Desktop can use the Virt-Manager. To give an idea here is a glimpse…
Go to the Application launcher and search for “Virtual machine manager”  (VVM) and run it. Before it opens, the system will ask to provide the root password. This will allow it to create and manage virtual machines.
Click on the PC icon to create a new virtual machine on Virt-Manager using KVM.
Click on the Browse button and then locate the ISO file you want to use for installing an operating system on your virtual machine as guest OS.
Create new virtual machine on KVM Virt Manager
 
After that uncheck the box is given for “Automatically detect from the installation media/source” and then click on the Forward button.
Select ISO file KVM Virt Manager
Set the amount of virtual memory you want to assign to VM and then the number of CPU cores.
Assign RAM virtual memory
 
To install 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 disk space you want to assign and move forward.
Create Virtual Disk Qemu image
 
Name your Virtual machine, here. Also, by default, the Virt-manager will use the NAT, however, you can select Bridge interface either the default one i.e vibr0, or the one you have created. If you don’t know about these settings let the default NAT be selected.
Virt Manager Configure NAT network
 
Finally, you will have a booted virtual machine that can be controlled just like any physical computer using a keyboard and mouse.
Install KVM virtual machine Debian 11 Bullseye
 
Other Articles:
How to install VirtualBox hypervisor on Rocky Linux 8
Install Qemu/KVM and Virt-Manager GUI on Ubuntu
How to install and use Virt-Manager on Windows 10
Install Clouds Windows 10 VM on Ubuntu with SNAP command
 
 
 
Debian

Debian

Debian

Debian

sudo virsh net-start default
sudo vrish net-autostart default <— You might want to correct "vrish" to "virsh"
Thanks Bill for pointing out this typo error…








This site uses Akismet to reduce spam. Learn how your comment data is processed.
Linux Shout crafted as a part of our main portal H2S Media to publish Linux related tutorials and open source Software.

source

We will be happy to hear your thoughts

Leave a reply

LINXGO
Logo
Compare items
  • Total (0)
Compare