Ubuntu 14.04 - Setting Up A KVM Host

Setting up a KVM host perfectly requires knowldege in a lot of areas, especially when it comes to setting up the networking and optimizing disk performance. This tutorial is aims to be an "idiots guide" and glosses over most of these details in order to get you up and running with a simple setup quickly. It will link to additional content, such as my KVM cheatsheet, where appropriate so that you can delve further into the areas that are appropriate for you.

This guide was written when Ubuntu 14.04 LTS was the latest LTS, but has been tested and works just the same on Ubuntu 16.04.

Constant Updates

KVM is such a large field, and is constantly evolving. I will be using these KVM tutorials whenever I configure a KVM host, and thus, they will evolve over time as I gain further knowledge and new features are released.

Hardware Requirements

For the time being, you need a dedicated server, or your own physical machine. You cannot setup a KVM Hypervisor on a VPS, such as a Digital Ocean or AWS EC2 instance. When I first wrote this tutorial, I used an Incero Instant server which was donated to me for research/testing. Unfortunately the service appears to have disappeared, but I hope it comes back. If you know a dedicated server provider that charges by the hour and deploys within minutes, thn please let me know in the comments below.

Installation Steps

Check Compatibility

First, let's check that the machine you are trying to set up as a KVM host is compatible:

sudo apt-get install cpu-checker -y
  • Alternatively, run egrep -c '(svm|vmx)' /proc/cpuinfo and if it returns a number greater than 0, you should be fine.

Install Packages

sudo apt-get install qemu-kvm libvirt-bin bridge-utils virtinst -y  

Note: You will also need virt-viewer if you want to install via VNC another day.

At this point we have a choice of creating a new user to manage the KVM virtual machines, or to make the current logged in user the manager. Pick one.

Please choose one of either of the options below:

Option 1 - Make Current User KVM Manager

sudo usermod --append --groups libvirtd $USER  

Option 2 - Create KVM User

Add a subuser with sudo priviledges and a home directory:

sudo useradd -d /home/$KVM_USER -m $KVM_USER
sudo passwd $KVM_USER
echo "$KVM_USER  ALL=(ALL:ALL) ALL" | sudo tee --append /etc/sudoers

Note: Alternatively, you could use the adduser $KVM_USER command instead of useradd as this will automatically prompt you for a password and set up a home directory

Warning: When I tried to run everything as root instead of creating a user I received permission issues with the created disk images that were automatically made.

Add the kvm user to the libvirtd group

sudo usermod --append --groups libvirtd $KVM_USER  

Log in as the kvm user. All commands from here on will be executed within this account.

su $KVM_USER  

Check the Installation

Check that installation went okay by running the following command:

sudo virsh -c qemu:///system list  

[ You should see something like above ]


You now have a working KVM Host on which you can deploy virtual machines. I now suggest you read my getting started with KVM article so that you can quickly start deploying your own virtual machines with little to no effort/research.


Please refer here.



Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.