How to install KVM on Debian 10 / Ubuntu 20.04?

Windows Articles

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...

How to use CHKDSK in Windows 10

Hello! It is very important to ensure the integrity of the hard disk in the computer. Since it is an essential element for the...
angeloma
angeloma
Senior Writer and partner

Hello friends, in this post I will show you how to install KVM on Debian 10 / Ubuntu 20.04.

KVM stands for Kernel-based Virtual Machine and is a virtualization technology integrated into the Linux kernel. Specifically, with KVM you can turn Linux into a hypervisor that allows a host machine to run multiple, isolated virtual environments called virtual machines (VMs) or guests.

KVM is open-source software. The Kernel component of KVM is included in the Linux mainline, as of 2.6.20. So if you use Linux you already have this feature available.

Linux Kernel 5.8 Released

So in summary with KVM we can create virtual machines quickly and take advantage of all the potential and modules of the kernel.

Before we start…

While it is true that KVM is built into the kernel as a module, not all processors support it. So the first step is to verify that your processor supports this feature.

So, open a terminal and run it according to your processor:

For AMD:

:~$ cat /proc/cpuinfo | grep svm

Or for Intel processors:

:~$ cat /proc/cpuinfo | grep vmx

If you do not get any screen output, then your processor does not support KVM.

Another way to find out is to run this command:

:~$ egrep -c '(vmx|svm)' /proc/cpuinfo
4

If you get an output per screen greater than 0 then you can use KVM.

Install KVM on Debian 10 / Ubuntu 20.04

Now that we know that we will be able to use KVM on Debian 10 or Ubuntu 20.04, then it can be installed without problems.

So, to do this in the terminal, run the following command:

:~$ sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
augeas-lenses gir1.2-libosinfo-1.0 ibverbs-providers ipxe-qemu libaugeas0 libcacard0 libcapstone3 libfdt1 libgovirt-common libgovirt2 libgtk-vnc-2.0-0 libgvnc-1.0-0
libibverbs1 libnetcf1 libosinfo-1.0-0 libphodav-2.0-0 libphodav-2.0-common librdmacm1 libspice-client-glib-2.0-8 libspice-client-gtk-3.0-5 libspice-server1
libusbredirhost1 libusbredirparser1 libvdeplug2 libvirglrenderer0 libvirt-glib-1.0-0 libvirt0 libxencall1 libxendevicemodel1 libxenevtchn1 libxenforeignmemory1
libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1 osinfo-db ovmf python3-libvirt python3-libxml2 qemu-system-common qemu-system-data
qemu-system-gui qemu-system-x86 qemu-utils seabios spice-client-glib-usb-acl-helper virt-viewer
Suggested packages:
augeas-doc augeas-tools libosinfo-l10n libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-rbd libvirt-daemon-driver-storage-zfs numad auditd
nfs-common open-iscsi radvd systemtap zfsutils samba vde2 qemu-block-extra sgabios debootstrap
The following NEW packages will be installed:
augeas-lenses bridge-utils gir1.2-libosinfo-1.0 ibverbs-providers ipxe-qemu libaugeas0 libcacard0 libcapstone3 libfdt1 libgovirt-common libgovirt2 libgtk-vnc-2.0-0
libgvnc-1.0-0 libibverbs1 libnetcf1 libosinfo-1.0-0 libphodav-2.0-0 libphodav-2.0-common librdmacm1 libspice-client-glib-2.0-8 libspice-client-gtk-3.0-5
libspice-server1 libusbredirhost1 libusbredirparser1 libvdeplug2 libvirglrenderer0 libvirt-clients libvirt-daemon libvirt-daemon-system libvirt-glib-1.0-0 libvirt0
libxencall1 libxendevicemodel1 libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1 osinfo-db ovmf
python3-libvirt python3-libxml2 qemu-kvm qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils seabios spice-client-glib-usb-acl-helper
virt-viewer virtinst
0 upgraded, 54 newly installed, 0 to remove and 55 not upgraded.
Need to get 24.0 MB of archives.
After this operation, 87.1 MB of additional disk space will be used.
Do you want to continue? [Y/n]

And wait for the download and installation to be completed.

When the download is complete, verify that the libvirtd service is working properly.

:~$ sudo systemctl status libvirtd
1.- Check the libvirtd service status
1.- Check the libvirtd service status

By default, KVM networks are disabled. You can check this with the following command:

:~$ sudo virsh net-list --all
Name        State         Autostart     Persistent
----------------------------------------------------
default     inactive         no            yes

To activate them and make them start automatically, just run these commands:

:~$ sudo virsh net-start default
Network default started
:~$ sudo virsh net-autostart default
Network default marked as autostarted

And with this, KVM is ready to be used. Now it remains to create a new virtual machine to test the environment.

Conclusion

KVM is one of the most outstanding technologies of the Linux kernel. This technology, widely used in many data centers and cloud technologies, takes Linux management to another level. It can also be used for home use.

So, share this post and join our Telegram Channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...

How to use CHKDSK in Windows 10

Hello! It is very important to ensure the integrity of the hard disk in the computer. Since it is an essential element for the...
x