Skip to main content

How to Install KVM and Create Virtual Machines on Ubuntu Desktop


In this tutorial, I will show you how to install KVM and create a virtual machine on Ubuntu desktop. There are two ways to create virtual machines using KVM: using the command line tool virsh and using the graphical tool called virt-manager. I will introduce the usage of virt-manager. virt-manager can use either QEMU or KVM as its hypervisor.

Check Your CPU’s Hardware Virtualization Capability

Your CPU need to support hardware virtualization in order to use KVM. The following command will search svm and vmx in /proc/cpuinfo file and return how many instances it found.

egrep -c ‘(svm|vmx)’ /proc/cpuinfo

The virtualization technology used in AMD processors is called AMD-V. The CPU flag for AMD-V is svm which stands for secure virtual machine.

Intel processors use VT-x to support hardware virtualization for x86 platforms. The CPU flag for VT-x is vmx and it stands for virtual machine extensions.

So if the above command returns number 0 in your terminal, that means your CPU does not support hardware virtualization and you have to use Virtualbox or VMware to create virtual machines. If it returns a number greater than 0, then you CPU supports hardware virtualization and you can continue to read this article to learn how to use KVM. For example, my computer has a quad core Intel CPU and all of them provide VT-x support, so this command returns number 4.

how to tell if your cpu supoorts hardware virtualization

Virtualization technology can still be disabled in your computer’s BIOS so make sure you have enabled virtualization feature in the BIOS setup.

Install KVM on Ubuntu

Use the following command to install KVM on Ubuntu

sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager virtinst virt-viewer

The bridge-utils is used to create bridge networking so other devices on your network can see your virtual machine.

Create Virtual Machines With KVM

Launch the graphical tool virt-manager from Dash. Its name in the applications menu is virtual machine manager.

virtual machine manager

In the virtual machine manager window, click the first icon in the toolbar.

create virtual machine

Choose the location of your installation media. I chose local install media.

choose location of installation media

Then specify the path of your iso image and select the OS type and version. I chose a ubuntu iso image.

specify path of iso image

Next, allocate memory and CPU to your virtual machine.

allocate memory and CPU to your virtual machine

After that, specify the size of your virtual disk. virtual disk by default is dynamic. That means the real disk size will grow with demand. If you check the box before allocate entire disk now, then the disk size is fixed.

specify the size of virtual disk

In the next window, you can give your virtual machine a name. Then click finish to begin installing OS to your virtual machine.

give your virtual machine a name

The installation process begins.

The installation process begins

Here’s a screenshot of ubuntu vritual machine running in virt-manger window.

ubuntu vritual machine running in virt-manger window
Rate this tutorial
[Total: 0 Average: 0]