We have got mostly RedHat RHEL5 and CentOS 5 servers in this data center. Recently there is a need to have a Debian Lenny and Ubuntu Lucid Lynx installation for some temperary projects. Instead of setting up two new machines, it makes more sense to create two virtual Xen servers.
Installing Debian Lenny xen guest is a relatively easy task. All you need to do is to use the virt-install command that is from the python-virtinst package:
virt-install --name=test-debian-guest01 --vcpus=2 --file-size=10 \
--ram=1024 --nographics --paravirt --bridge=xenbr0 \
--file=/home/xens/test-debian-guest01.img \
--location=http://ftp.us.debian.org/debian/dists/lenny/main/installer-i386
This brings up the standard Debian installer as if you are installing Debian on a regular PC. Once you finish the Debian installation, the guest OS restarts and you are up with Debian.
Ubuntu DomU gives me lots of trouble. After many hours of failure, I found there was an incompatibility in the xen package that comes with RHEL / CentOS 5.5 (the current release). Long story short, latest Ubuntu LTS Lucid use Grub2 that is not supported by the xen bootloader pygrub that is part of RHEL 5's xen package. The good news is this is fixed in the upcoming RHEL 5.6 that is currently in beta. More details can be found in RedHat Bugzilla.
To make life easier for our readers, I took the patches from bugzilla and built the new xen rpms:
- Binary RPM: xen-3.0.3-110.el5_5.5.i386.rpm, xen-libs-3.0.3-110.el5_5.5.i386.rpm and xen-devel-3.0.3-110.el5_5.5.i386.rpm
- Source RPM: (in case you want to build it yourself, especially if you are running RHEL / CentOS 64 bit) xen-3.0.3-110.el5_5.5.src.rpm
Once you have updated the xen package(s) on your system, you will need to reboot the host machine. Hopefully it comes up ok and you can start the Debian / Ubuntu installation.
First thing you need to decide is where you want to install the guest OS. You can use file based disk image, an actual second raw disk, or LVM groups. In this exercise, we use the easiest disk image file of size 40G. We will create it sparse with "holes" so the creation process is faster, and space will be allocated only when needed.
dd if=/dev/zero of=/home/xens/guest01.img bs=1 count=0 seek=40G
Next, we will download the initial xen config file xm-debian.cfg for our test guest OS. You can grab it from the different locations: 32 bit Ubuntu 10.04 LTS Lucid, 32 bit Debian Lenny, 64 bit Ubuntu Lucid.
Once you have the xm-debian.cfg, you can copy it to your /etc/xen directory and rename to anything you want. We call it guest01.cfg here. We will need to modify the guest01.cfg to suit our needs (memory/cpu allocation to guest, MAC address, disk image location, hostname, etc):
memory = 1024
name = "guest01"
vcpus = 2
vif = [ 'mac=00:16:3E:46:B2:D0,bridge=xenbr0' ]
disk = [ 'file:/home/xens/guest01.img,xvda,w' ]
Also, you need to find the line bootloader="pygrub" and change it to bootloader="/usr/bin/pygrub" (give the full path of pygrub).
Finally, we are ready for the installation by running the command: xm create -c guest01.cfg install=true
This will kick off the standard Debian / Ubuntu installation, which, I am not going to detail here. Once the installation finishes, OS installer will halt the guest system. You can start/boot the Virtual Machine manually by xm create -c guest01.cfg This will attach to the console (-c option) so you can watch the guest OS booting up, and finally login to the guest OS from its console. You can detach from the guest console by holding Ctrl key and ]
If you want the guest OS to be automatically started when you reboot your host OS (RHEL / CentOS), on the host machine you can symlink the guest config file to the auto directory: ln -s /etc/xen/guest01.cfg /etc/xen/auto
If you had chosen openssh server during the guest OS installation, you should now be able to ssh into the guest. Otherwise, you can always attach to the guest (DomU) console from the host (Dom0) machine: xm console guest01 Again, you can detach by Ctrl - ]
- Log in to post comments
I am having the same problem, but I am install Ubuntu 10.04 on CentOS 5.3 Xen.
Is it possible to fix without updating Xen? As I don't want to affect existing running machines.
Thanks.