Headless Linux Virtualization with KVM

J BothaJ Botha
Blade server rack in large data-center in Calgary

Kernel-based Virtual Machine (KVM) is a virtualization infrastructure for the Linux kernel which turns it into a hypervisor. KVM was merged into the Linux kernel mainline in version 2.6.20 (February 2007). Like most Hypervisors, KVM requires a processor with hardware virtualization extensions. What makes KVM stand out the most to us is the minimal setup, high performance, cost (Free under LGPL/GPL) and its nativity to Linux.

We have tried various other headless hypervisors such as VirtualBox, OpenVZ, VMware and Xen to name a few. With so many flavors of Linux out there today, some of these options were very difficult or not possible to implement, whereas KVM came through for us on all our various platforms. With an easy-to-use command line structure, spinning up new machines was as easy as typing a single line command.

Some cool features with KVM we found are: Option to use Remote Desktop (RDP) and/or VNC attachments for remote control, Hardware emulation capable of 1-160 CPUs and 32 TB of RAM, and a slew of optional management tools available like KVM Switch for networking aspects.

One of our goals to use a Linux hypervisor was to find a way to build our own interface (web-based) to easily and reliably spin up new environments for both development and production purposes. Some of the challenges we faced with some of the other hypervisor implementations was being able to interact with the individual virtual machines through a custom website. Making changes to a virtual machine’s properties also became a cumbersome task until we came across KVM. Simply shut the machine down and re-issue the boot command with altered command flags for more/less RAM, CPU etcetera.

KVM like any hypervisor isn’t perfect. For example, it’s difficult to implement “100% uptime” strategies with KVM. Snapshotting / cloning KVM typically requires a shutdown of the virtual machine, which is not necessarily a good approach for large corporations or businesses that are mission critical. Where this is the case we will usually for a more robust hosting service such as Microsoft Azure.

All-in-all we were very happy with KVM and our Web-based hypervisor project. With a basic setup as easy as running an “apt-get install kvm” on an ubuntu server and following a quick guide, we had a working hypervisor in no time. For those seeking a headless Linux virtualization solution, we highly recommend KVM. For additional information and documentation, you can visit linux-kvm at: https://www.linux-kvm.org/page/Main_Page