1. Prepare a Xen VM with a minimal install of CentOS/RHEL 5 (64bit or 32bit).
    1. Make sure you have set your host name and IP Addressing etc. The VM should have internet access (obviously).
  2. Install HyperVM following these instructions.
    1. Be sure to append [–virtualization-type=openvz] (omit the square brackets) to the install command.
  3. At the end of the installer, don’t reboot!
    1. The default OpenVZ kernel installed by the HyperVM installer won’t work inside of a Xen VM (it will work on a normal bare metal server). Download the proper kernel for your architecture: 32bit (i686) or 64bit (x86_64). At the time of writing, the current OpenVZ kernel was 2.6.18-384.4.1.
    2. You are specifically looking to download and install the kernel that starts with: ‘ovzkernel-xen’ anything else will likely install, but will not boot!
    3. Install using this command [# rpm -ivh ovzkernel-xen-*.rpm] – Don’t use [# rpm -Uvh] you will upgrade the installed kernel instead and you will lose the ability to roll back to a known working kernel should things go wrong.
    4. Open your /boot/grub/grub.conf file (in vi or nano) and make sure you are able to differentiate between the existing kernel and the ovzkernel-xen kernel. Perhaps append something to the title line, like ‘OpenVZ-Xen’. I saw three kernels in mine, the original CentoS 5 kernel, the OpenVZ kernel (installed by the HyperVM installer) and the OpenVZ-Xen kernel.
  4. Now it’s time to reboot. How you perform this step will be dependant on a couple of things.
    1. If you have console access to your VM (it may be via an alternate SSH connection or applet if your hosting provider has one), I suggest not editing your grub.conf file just yet. Connect to the console and reboot the VM. You can then catch the grub boot loader and choose the OpenVZ-Xen kernel (not to be confused with the similar named OpenVZ kernel). If all goes well, you can edit the grub.conf file later and set grub to boot from the OpenVZ-Xen kernel by default. If things break, you’ll either be able to reboot and choose a different ‘known working’ kernel, or your VM won’t boot at all. In this case you’ll have to ask your hosting provider to switch your default kernel back to the original kernel. If you have Dom0 access (you’ll know what this if you do) you can edit grub.conf via pyGrub and try again.
    2. If you don’t have console access, you’ll need to edit the grub.conf file first and set the OpenVZ-Xen kernel as the default kernel and reboot, hoping all goes well. As above, if all does go well, you’ll be able to login via SSH and also to the HypeVM control panel. If things break and you lose access to your VM, you’ll have to contact your hosting provider and have them investigate for you. You can assist them be asking them to configure grub to boot from the standard normal CentOS kernel again. Afterwards, when you have access, you can try again 😉
  5. By default, HyperVM wants to use the ‘Xen driver’ as the virtualisation method. This won’t work, you can’t run xen VMs inside of a Xen VM. Why Xen is the default ‘driver’ when you chose OpenVZ at the very beginning? I have no idea.
    1. Use the following commands to switch the system from Xen to OpenVZ [#. /scripts/directory] [# lphp.exe ../bin/common/setdriver.php –server=localhost –class=vps –driver=openvz] (omit the square brackets of course). There are two commands, the first changes the current working directory, the second changes the virtualisation driver.
    2. After a few moments, you’ll see a confirmation message.
  6. You’re done! You can now login to the HyperVM control panel, add IP Addresses and create VMs!

Comments, Suggestions, Requests, all welcome 😉

2 Thoughts on “Installing HyperVM Inside a CentOS/RHEL 5 Xen VM

  1. Pingback: FATAL: kernel too old (OpenVZ) « Mokona Modoki

  2. Hi,

    Thanks for the article. It does work. Never thought it will be easy. But, yes, there are a lot of things that one has to configure to make sure hypervm is working in xen vps. First, adding ippool and configure resource plan. In adding ippool, you will find the ips are already assigned to the xen vps. You need to do something about it. Google it.

Leave a Reply

Post Navigation