If done properly, installing the Xen hypervisor can open up opportunities for lab experimentation and, potentially,...
a low-cost production platform. Thanks to its free availability and simple deployment process, it's become increasingly popular in recent years with companies large and small.
Once you've decided that Xen is the hypervisor for you, the next step is to create a Domain-0 VM using the OS of your choice. In this guide, I'll show you how to set up Domain-0 on Ubuntu. While I found the process to be rather easy, I imagine finding the proper management tools to orchestrate this on an enterprise level might be challenging, but companies like Peugeot have found ways to make do.
Installing Xen on Ubuntu 14.04, in particular, is remarkably straightforward. Allowing Ubuntu to run on top of Xen stopped my HP Envy laptop from rebooting itself about once every other day while running Ubuntu. According to Stack Overflow, this was a problem unique to me; when I spoke with HP support, they simply said they do not support Ubuntu, and left it at that. I'm choosing to see it as an added bonus.
Ubuntu running atop Xen looks the same as regular Ubuntu. The only noticeable difference is that the ability to put the computer in "suspend mode" is gone; now the only option is to shut down entirely. In order to get started, you must wait 30 seconds or so for Xen to boot up before Ubuntu does, since Xen powers the PC and not Ubuntu.
To configure Ubuntu to be a Xen Domain-0, you must first install Ubuntu; make sure to select the logical volume manager when doing so. Then run the following command:
sudo apt-get install xen-hypervisor-amd64
Finally, reboot your PC.
Unfortunately, the Xen website's instructions for installing Xen hypervisor on Ubuntu are a bit dated, as they provide no simple screen by which to tell Ubuntu how much of your hard disk to use. Instead, you are presented with a rather complicated partition screen. When I installed Domain-0 on my own PC, it took over the entire drive, leaving no space for another VM. Thankfully, I had a solid-state drive on which I was able to install Windows on solid-state storage, where it should, presumably, run quickly. However, there is one caveat: The Xen Project says Windows will run slowly on Xen in hardware-assisted virtualization mode unless you install the paravirtualization drivers, which, as previously stated, Citrix and others provide.
Once you follow the one-line instruction shown above and reboot, you can see the Domain-0 VM with this Xen command, also displayed in Figure A:
sudo xl list
Once this is complete, you will still see an empty screen, which may leave you wondering how to log in to the VM. To do this you need a virtual network computing client like the Windows Terminal Server or Vinagre. If you are using the Citrix XenServer, you have the option of using XenCenter.
Once I set up Domain-0, I used the Xen xl command line tool to continue with my first VM. Initially, the instructions on the Xen Project website told me to configure a bridged network so that the VM would have its own IP address. The instructions say to use Open vSwitch instead of NetworkManager to do so, but when I did that I got stuck, as the Windows VM would not recognize the network interface. I tried to configure a bridged network a second time using the libvirt tool and NetworkManager and was successful.
To set up a VM, you must make a variation of the configuration file shown in Figure B and run the following command:
sudo xl create <config filename>
Be sure to note the network interface (vif) and the image and ISO file locations (disk).
As you can see, it's really quite easy to install Xen on Ubuntu. All it takes is a little careful configuration and you'll be well on your way to taking advantage of the full capability of the Xen hypervisor.
Xen, KVM and other free hypervisor options
Cloud vendors boost Xen capabilities
Reboots call hypervisor security into question