Installation and Configuration of virtualization using KVM in Ubuntu.

Spread this useful information with your friends if you liked.

By: Ankita Kulkarni

Before we dine into the practical, lets first understand the theory part related to this practical.
What is Virtualization?
  • Virtualization creates a virtual layer using the hypervisor software.
  • It is the process of creating a virtual version of something like computer hardware, OS, etc.

What is KVM?

  • Kernel-based Virtual Machine (KVM) is an open source Virtualization technology built into Linux.
  • It allows you to turn the Linux into Hypervisor that allows the host machine to run multiple, isolated virtual machines or guests. 

What are the types of Hypervisor?

  • Type 1 Hypervisor: The hypervisor runs directly on the underlying host system. It is also called as “Bare-metal hypervisor”.
  • Type 2 Hypervisor: The host OS runs on the underlying host system. It is also called as “Hosted hypervisor”.

Pre-requisites:
1. Before you begin with installing KVM, check if your CPU supports hardware virtualization:

egrep -c '(vmx|svm)' /proc/cpuinfo

If the command returns a value of 0, your processor is not capable of running KVM. On the other hand, any other number means you can proceed with the installation.

2. Now, check if your system can use KVM acceleration by typing:

sudo kvm-ok

If kvm-ok returns an error stating KVM acceleration cannot be used, try solving the problem by installing a cpu-checker.

3. To install cpu-checker, run the following command:

sudo apt install cpu-checker

4. When the installation completes, restart the terminal.

 

Install KVM on Ubuntu 20.04

Creating a Virtual Machine on Ubuntu 20.04

1. Install virt-manager, a tool for creating and managing VMs:

sudo apt install virt-manager

2. Type Y and press ENTER. Wait for the installation to finish.

Make sure you download an ISO containing the OS you wish to install on a VM and proceed to pick an installation method.

Virt Manager GUI

1. Start virt-manager with:

sudo virt-manager

2. In the first window, click the computer icon in the upper-left corner.

3. In the dialogue box that opens, select the option to install the VM using an ISO image. Then click Forward.

4. In the next dialogue, click Browse Local and navigate to the path where you stored the ISO you wish to install.

Click on Forward

Click on Forward

Click on Forward

Click on Finish

Select the language

Enter –> select option Installing Ubuntu

Click on Continue

Leave the default options as it is shown in the image.

Leave the default options as it is shown in the image and click on Install Now.

Click on Continue

Set Your name and password accordingly and click on Continue.

To remove virtual machine completely:

sudo apt-get remove --auto-remove virt-manager

Spread this useful information with your friends if you liked.

Leave a Comment

Your email address will not be published. Required fields are marked *