HOWTO Install XCP in KVM (nested hypervisor)

There might come a time when one wants to test Xen Cloud Platform (XCP) or XenServer without needing to wipe an entire physical machine.  Fortunately (at least with XCP 1.1), XCP can easily be installed within a virtual machine!

The main caveat in doing this is that HVM guests will not be supported if the virtual machine doesn’t export the host system’s HVM support (e.g. VT), which is probably generally the case with the Kernel Virtual Machine (KVM) available and easily installable in Ubuntu, Debian, RedHat Enterprise Linux (RHEL), and CentOS.

It might be possible to install XCP in Qemu in this fashion, but the author of this HOWTO has not yet tried this.  It is probably possible to install XenServer in KVM (and might be possible to install XenServer similarly in Qemu), but the author of this HOWTO has also not tried to do this.

If you have any questions or comments, please feel free to comment here, or just contact me!

0. Before You Begin

The setup I used for testing this tutorial (YMMV):

  • Hardware: Intel Core i7 680UM quad-core processor with VT enabled in BIOS, 4 GB RAM
  • Operating System: Ubuntu 11.10 x86_64
  • Packages: Kernel Virtual Machine (KVM), virt-manager,
  • Installer Handy: Xen Cloud Platform version 1.1 (XCP 1.1)

I also ensured:

  • Laptop connected to AC
  • Reliable Internet connection (useful for installing guest VM later)

1. Install Necessary Packages

The packages that need to be installed in your OS of choice include:

  • kvm
  • virt-manager

I also recommend the packages:

  • vnc-viewer or vinagre or tsclient or some other VNC client
  • An ssh client
If you use Ubuntu, as per Ubuntu Documentation/KVM/Installation, you can install the necessary packages by running the following command in your Terminal (Ctrl+Alt+T from the desktop):
sudo apt-get install qemu-kvm libvirt-bin bridge-utils

You can then install the additional packages required for this tutorial by running the following command in your Terminal:

sudo apt-get install virt-manager vinagre

At this point, you are now ready to download the XCP installer Base ISO.

2. Download Xen Cloud Platform (XCP) Installer

After the above command finishes successfully, the next step is to download the installer Base ISO (CD image) file for XCP.  At the time of this writing, XCP 1.1 was the latest version, so that’s the version I tested (YMMV).

Click on ONE of the following links (I recommend trying top to bottom, and avoid running any that might eventually become outdated):

USEFUL TIP: Don’t be stupid like me. If you are currently encrypting your home directory in Ubuntu, YOU WILL NEED TO copy the downloaded installer Base ISO file to a directory OTHER THAN your home directory, since the virtualization toolstack will not be able to access your home directory to boot from the ISO file.  I solved this by creating a directory /vmimages/ (sudo mkdir /vmimages) and moving the downloaded ISO file there.  I also store my virtual hard disks for my VMs there for the same reason.

3. Install XCP in KVM

Next, you will create a virtual machine for testing XCP and install XCP inside of the test VM.

3.1. Create XCP Virtual Machine in virt-manager

In your Terminal window, run the following command:

sudo virt-manager

This will start the virt-manager tool, which I find especially useful for managing VMs in KVM.  This tool is probably available for your favorite Linux distribution too, since I think it first appeared on RedHat flavors before being ported to Ubuntu.

Next, perform the following steps:

  1. In the top-left corner of the Virtualization Manager window, click the Create a new virtual machine button.
  2. Enter a name for your new XCP test VM, choose Local install media (ISO image or CDROM), and click Forward.
  3. Select Use ISO image and Browse to the location of the XCP installation Base ISO file you downloaded (see the above “USEFUL TIP”), then click Forward.
  4. Choose the amount of virtual memory (RAM) and virtual CPUs to provide to the new XCP test VM, then click Forward. Note: Your guest virtual machines running beneath XCP will also occupy this same virtual memory that XCP will be using; as such, I recommend at least 1024 MB if you will testing XCP and only 1-2 lightweight Linux guest VMs, and up to as much as you feel you can afford to give to your XCP test environment.
  5. Select Enable storage for this virtual machine and choose Create a disk image on the computer’s hard drive. Next, enter a size for the XCP test virtual machine’s virtual hard drive file, and it is recommended to select Allocate entire disk now, then click ForwardNote: This virtual hard drive file will not only contain XCP, but it will also contain the virtual hard disk files of guest virtual machines you wish to run beneath XCP; as such, make sure this is large enough for your needs (the XCP installer would not allow me to use a disk sized at 8.0 GB, and the next disk size I tried was 30.0 GB, which did work–YMMV, so try setting it to a high enough value to begin with to save yourself the hassle of starting all over again).
  6. Choose your desired network settings, select kvm as the Virt Type, choose your desired Architecture setting, and click Finish to begin the XCP installation.  Note: kvm and x86_64 worked for me, as well as Virtual network ‘default’ NAT as settings on this screen–YMMV.

Complete the XCP Installation

Hopefully the XCP installation program will boot successfully in your newly created KVM test virtual machine.  If so, continue with the following steps:

  1. The XCP installer should boot and, after selecting your keyboard layout, it should ask you if you wish to load a device driver or simply proceed with the installation.  Select Ok and proceed with configuring the XCP installation.
  2. At some point early in the XCP installation process, the following warning will probably appear: Hardware virtualization assist support is not available on this system. This warning means that HVM support (e.g. Intel VT support) is not available from within your KVM test virtual machine, and is expected. If this error does appear, choose Ok and proceed with the installation, but note that you will only be able to run paravirtualized guest VMs beneath XCP (so, at the time of this writing, no Microsoft(R) Windows(R) VMs). If this error does not appear, then, somehow, you might have the ability to provide nested HVM support–I have no idea, so good luck and let me know what happens!
  3. Choose to use the provided virtual hard disk for installation, and click Ok.
  4. Choose to use Local media for the XCP installation source, and click Ok.
  5. When you reach the Supplemental Packs prompt, choose No if you have no idea what this means.
  6. Proceed with the installation. If you decide to use NTP (probably unnecessary) for automatic time setting, three servers I know of are and and and are what I used in my configuration.
  7. At some point, you will reach a Confirm Installation dialogue, where, if you are certain you wish to proceed, you may choose Install XCP.
  8. If you are fortunate, you will reach an Installation Complete message.  At this point, clicking Ok should be the only thing you need to do to restart the XCP test virtual machine.
  9. If you are even more fortunate, you will see a screen like the following, which indicates that XCP is booting inside of your KVM virtual machine!
  10. The finish line looks like the following screen.  Congratulations!


Author: Patrick F. Wilbur
Author’s website:

Creative Commons License
This HOWTO and all of its screenshot images are licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. You may use, reproduce, and/or adapt this work, so long as the above author name and website are intact and/or referenced in all reproductions and adaptations of this work that you make.

Thank you for reading!  If you have any comments or questions, please feel free to comment, below. Otherwise, you may also contact me!

One Comment

  1. Christian Mesh says:

    yo dawg,I heard you like hypervisors so I put a hypervisor in your hypervisor so you could virtualize while you virtualize!

Leave a Reply

Your email address will not be published. Required fields are marked *