by April 12, 2005 0 comments



Virtual machines emulate certain environment required for applications-so that applications can be run inside them. Some virtual machines, like those for Java and .NET allow you to run only applications whereas some like VMWare, Microsoft Virtual PC and Xen let you run entire OSs. We have covered virtual machines like VMWare and Bochs that run on a Linux host and run Windows or Linux OSs inside them. 

This article tells about setting up Xen, which uses Linux as the host and runs various Linux distros inside it. Xen package may be a part of Fedora Core 4. We will use PCQLinux 2005 as the host and let you select a Linux distribution(s) to be the guest OS. 

Install and configure Xen
Download the Xen source and binary packages from http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-2.0.5-src.tgz 
and http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-2.0.5-install.
tgz. Extract the archives which will produce directories named xen-2.0 and xen-2.0-install respectively. Change to the directory xen-2.0 and issue:

make install-twisted

Direct Hit!
Applies to:
Sysadmins, Developers and Linux enthusiasts 
USP:
Run different Linux distros simultaneously
Links:
http://www.cl.cam.ac.uk/Research/SRG/netos/xen/ 

Change to xen-2.0-install and run ./install.sh. Now append the following to
/etc/grub.conf:

title Xen 2.0
kernel /boot/xen.gz dom0_mem=130000
module /boot/vmlinuz-2.6.10-xen0 root=/dev/hdd1 ro console=tty0
module /boot/initrd-2.6.10-1.741_FC3.img

Install another Linux distro (say RHEL, Debian) on another partition on your machine.

To configure Xen, reboot the machine and when the boot options show up, select ‘Xen 2.0’ and press Enter. This will boot up PCQLinux using the Xen kernel-customized for virtual machine operations. Now you should be able to login as root. Note that password, configuration and all other settings remain the same as in the host OS. The only change is that we have booted with a customized Xen kernel. Upon login, create a file named guest in /etc/xen directory with:

kernel = “/boot/vmlinuz-2.6.10-xen0”
memory = 128
name = “guestos”
nics = 1
ip = “192.168.1.1”
disk = [‘file:/dev/hda6,hda6,w’]
root = “/dev/hda6 rw"

Substitute hda6 with the partition on which you installed the guest OS. 

Launch the guest OS
Open a terminal window in X and issue:

/etc/init.d/xend start

Then issue the following to launch the guest OS:

xm create -c /etc/xen/guest vm=1

This should start the boot sequence for the guest OS and let you login to the guest Linux OS. If you issue the ifconfig command on the host OS, you will be able to see a virtual network interface named xen-br0. Through this virtual interface the host OS will be able to access the guest OS and the services running on it.

Shekhar Govindarajan
IT4Enterprise

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.