KVM can be managed using a command line or available graphical tools. Virt-Manager (Virtual Machine Manager) is the most widely used application for managing KVM based virtual machines. It supports creating, editing, starting, and stopping KVM-based virtual machines, as well as the live or cold migration of guest machines between hosts.

Prerequisites

As said earlier, KVM will work only if the CPU has the support of hardware virtualization, either Intel VT or AMD-V.

To find whether your CPU supports VT features, run the following command.

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

CentOS 7 – Intel VT Support

If the above command returns with output showing VMX or SVM, then your hardware supports VT else it does not.

Create a network bridge so that virtual machines can communicate with the external network.

libvirt-client = provides client-side API for accessing servers and also provides the virsh utility which provides command line tool to manage virtual machines.

virt-viewer – Graphical console

Create Virtual Machine

Once you have installed KVM and other tools, it is all set to start creating virtual machines. We will look be looking at creating virtual machines both in command-line and graphical mode.

Command Line Mode

virt-install is used to create virtual machines using the command line mode, and this command needs multiple inputs from us to create a virtual machine such as CPU, Memory, disk, network, installation media location, OS variant and more.

Graphical Mode

Type the following command in the terminal in GUI mode.

virt-manager

OR

Application >> System Tools >> Virtual Machine Manager.

You may be asked to enter a password if you don’t have root access.

Once it is opened, right-click on localhost(QEMU) and Click on New. Virtual Machine Manager will start a new wizard for creating a virtual machine. You will find no difficulty in using this graphical mode.

Step 1: You would require naming your virtual machine, in the same window, you would be asked to choose how would you like to install the operating system. Here I chose to install it from ISO image or CD-ROM.

Install KVM (QEMU) on CentOS 7 – Virt Manager – Create VM

Step 2: Enter the location of ISO image as the physical CD-ROM pass through is not supported by the hypervisor, do not forget to choose operating system type and version.

Install KVM (QEMU) on CentOS 7 – Virt Manager – Installation Media

Step 3: Configure CPU and memory for the virtual machine.

Install KVM (QEMU) on CentOS 7 – Virt Manager – Memory and CPU

Step 4: You have to mention the amount of storage that you want to assign to a virtual machine, Uncheck on “Allocate entire disk now“, this will prevent from allocating full disk at the VM creation.

Disk size will be allocated dynamically depending on the virtual machine usage.

Install KVM (QEMU) on CentOS 7 – Virt Manager – Allocating Storage

Step 5: Summary of all the settings, click on advanced settings to select bridged networking to allow the virtual machine to communicate outside the network.

Click on Finish.

Install KVM (QEMU) on CentOS 7 – Virt Manager – Summary

Step 6: KVM will start to create a virtual machine depends on our input, once VM is created. Virt manager will start a console for OS installation.