12 C
Texas
angeloma
Senior Writer and partner

How to install KVM on Debian 10 / Ubuntu 20.04?

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

- Advertisement -

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article