Qemu

Qemu tutorial

Linux comes with various tools that are integrated into its Kernel which allows you to do various tasks. One of such tasks is virtualization of the operating system which in simpler words means creating a system within another.

We are all familiar with Virtual Box and VMware Workstation Player and how and how they work, similarly Qemu allows creation of virtual machines in Linux and other operating systems to run Linux distributions.

If qemu is used as a machine emulator, it can run the tools and programs created for a particular machine on other machines and achieve a high performance through dynamic translation. In this article we will discuss how to install Qemu along with it’s configuration and how to create a virtual machine with it.

Installing Qemu on Linux

One of the perks with QEMU is that it’s already available from the official repository of Ubuntu and hence the installation becomes less difficult and a few steps process.

Firstly, we need to update our repository and for that the below command needs to be executed:

$ sudo apt update

Now we need to install QEMU on our system and along with that we need to install kvm as well as a virtual machine, and for that the following command needs to be executed:

$ sudo apt install qemu-kvm virtinst qemu virt-manager libvirt-daemon libvirt-daemon-system bridge-utils virt-viewer libvirt-clients

Here we installed couple of different packages required to start our virtual machine, the first one is called qemu containing application, along with that we installed qemu-kvm which is a package in which KVM is used to virtualize processes whereas virt-manager and virt-viewer are installed for GUI purposes. Lastly libvirt contains binaries for both QEMU and KVM which they used for service monitoring and virtualization.

Now after the installation process is completed you need to check the status of libvirt and for that execute the command provided below:

$ sudo systemctl status libvirtd

This gave us an active signal and now you can use the QEMU either from terminal or through virtual manager from the main menu.

Creating a Virtual Machine using Virt Manager

Here in this tutorial we’ll create a virtual machine “Ubuntu 20.04” through virtual manager and the first thing for that would be to launch the virtual manager from the menu which will pop up the below screen:

Now here in this we will create and install a virtual machine “Ubuntu 20.04” and for that go to the File and select “New Virtual Machine” which will open up the below screen:

Here you can select the desired way to install the operating system. Select the “local install media”:

Here you’ve to select the ISO media. As we’re installing the server for Ubuntu 20.04 so download the installation image from the website and load it. I already have it on my Desktop:

This will auto detect the system and you simply have to click the forward button which will take you to the page where you’ve to assign Memory and CPU for your virtual system. Make sure to provide lesser values as shown in the image:

Now select the forward button and assign the disk image size according to the availability on your system:

After selecting forward you’ll be taken to the last step where you’ve to give your virtual machine a name or leave it as default:

Simply select on the Finish button and the booting for your virtual machine will be started:

After this instructions will pop-up which you can select to complete the process and once it’s completed you can access the system through virt-manager or through ssh.

Conclusion

Creating a virtual machine is always helpful as we can use various machines through a single interface, which helps in saving memory and time. In this tutorial we guided you through the installation of Qemu which is used for creating virtual machines. Further, we guided you to create a virtual machine using virt-manager, in which we created ubuntu 20.04. You can create other operating systems by loading the ISO file and following the steps provided.

 

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.