This tutorial is about How to install QEMU/KVM on Ubuntu. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to install QEMU/KVM on Ubuntu. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Table of contents
Check How to install QEMU/KVM on Ubuntu
QEMU is a type 2 user zone hypervisor (i.e. runs on a host operating system) for performing hardware virtualization (not to be confused with hardware assisted virtualization) such as hard disk, network, VGA, PCI, USB, serial/parallel ports, and so on. It’s flexible because it can emulate CPUs using dynamic binary translation (DBT), so code written for one processor will run on another (for example, ARM on x86 or PPC on ARM).
KVM is a Linux kernel module. It is a type 1 hypervisor that is a full virtualization solution for Linux on x86 hardware with virtualization extensions (Intel VT or AMD-V). But what is full virtualization? When the hypervisor (vCPU) emulates a CPU, the hypervisor must translate the instructions intended for the vCPU to the physical CPU. As you can imagine, this has a massive impact on performance.
To prevent this, modern processors support virtualization extensions such as Intel VT-x and AMD-V. These technologies provide the ability to allocate a portion of the physical CPU directly to the vCPU. Therefore, instructions destined for the vCPU can be executed directly on the physical segment of the CPU. In this article, we will show you how to install QEMU/KVM on Ubuntu.
How to install QEMU/KVM on Ubuntu
How to install KVM on Ubuntu 20.04
In the next section, we present how to install KVM on Ubuntu 20.04 LTS in three simple steps.
Install the necessary packages
- On your Ubuntu 20.04, run the following command to install the necessary packages:
- $ sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm
Check virtualization capabilities
- Run the following command to make sure your processor supports virtualization capabilities:
- The output of this command is pretty straightforward and clearly indicates whether KVM can be used or not:
- INFO: /dev/kvm exists
- KVM acceleration can be used
Launch a virtual machine
- To boot your first instance of Ubuntu Server 20.04 LTS on KVM, run the following command:
- $ sudo virt-install –name ubuntu-guest –os-variant ubuntu20.04 –vcpus 2 –ram 2048 –location http://ftp.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/ –bridge red =virbr0,model=virtio –graphics none –extra-args=’console=ttyS0,115200n8 serial’
This opens an interactive console that you can use to manually install the Ubuntu guest.
How to install QEMU on Ubuntu 20.04
One of the great advantages of QEMU is that it is available from the official Ubuntu repositories. Therefore the installation is outlined as very easy.
- To start it, open a terminal from the Ubuntu main menu or by pressing the CTRL + ALT + T keys
- Once the terminal loads, execute the following commands:
- sudo apt update
- sudo apt install qemu-kvm qemu virt-manager virt-viewer libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon
And we proceed to explain the installed packages. The qemu package is the package that contains the application. On the other hand, qemu-kvm is a package that we need for QEMU to virtualize processes with KVM. Since QEMU is a tool that provides us with a graphical user interface, we install virt-manager and virt-viewer to provide us with one. The libvirt packages are the binaries used by QEMU and KVM to perform virtualization and service monitoring.
- After that you can check the libvirtd service status
- sudo systemctl libvirtd status
- Once you have installed all the packages, you can use QEMU from the terminal or virt-manager from the main menu.
Final remarks: How to install QEMU/KVM on Ubuntu
I hope you understand this article, How to install QEMU/KVM on Ubuntu. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.