Using Xen the Easier Way

author-image
PCQ Bureau
New Update

The one and only one enterprise grade virtualization
software available in Open Source is Xen. It's highly secure, reliable and
works with minimum hardware overhead. But with all the positives there is also a
huge drawback-the configuration and installation is a nightmare.

Everything is done through command interfaces and by
modifying text configuration files. So, if you are not a Linux geek then this is
obviously not your cup of tea.

Direct
Hit!
Applies
to:
System and network admins
USP:
Use Xen virtualization without installing it
Links:
http://unit.aist.go.jp/itri/knoppix/xen/index-en.html
Google keywords:
Knoppix + Xen 
On
PCQXtreme CD:
Boot with the PCQXtreme CD

But there is something which can help you in deploying
this software in your enterprise. You can even test the performance of the
software and the guest

OSs


running on top of that before

deploying it.

This is done basically with the help of a Live CD which is
a customized Knoppix version with a Xen kernel. So, if you feel like testing Xen,
all you have to do is to boot the machine with the live CD and your Xen machine
will be up and running. This also comes with a pre-created Guest OS which has
the same kernel and file system as the Host OS. So, all you need to do to start
is, to run a simple

command:

$ sudo knoppixU

Running the Knoppix-installer will start a graphical interface like this. Now you can install the live CD on your HDD

More details on this command are available later  in
this

article. Whenever you feel that the application is good for your needs, you can
choose to install the Live CD onto your harddisk and configure more guest

OSs


of your choice. Here, we'll see how to go about it.

Installing Xen-Knoppix on the harddisk

I don't know whether you'll believe or not. The installation of Knoppix
nowadays is more easier than installing a standard Linux distro such as Fedora
or Debian. To do so, all you've got to do is to boot up your machine with the
Xen-Knoppix Live CD. Subsequently, open up the terminal and start the
installation with the following command:

#sudo knoppix-installer

Here, sudo command is used to start the installer with the
root privilege. If you don't use sudo then the application will terminate with
an error saying 'Permission Denied'. Now this command will open up a
graphical wizard. Just continue hitting OK or Next until you see a dialog box
which says 'Knoppix Partition Menu.'

Xen Knoppix has a very easy to use and completely graphical partition manager called qtparted

Here, select the first option which says 'Partition the
Hard Drive' and select Ok. This will open up a neat tool called parted. This
tool looks pretty similar to the PowerQuest Partition Magic. With the help of
this tool you have to create an ext3 partition and a swap partition. You can
have any specific size for these partitions. Just ensure that if you're
planning to have images of the partitions of the guest

OSs


in the same partition instead of having separate physical partitions, then
you should have a good amount of space in the ext3 partition. Now, create a swap
partition which is double the size of the amount of RAM you have. After you are
done with all of this, click on the floppy icon at the top left corner of the
windows which says 'Commit' to create the partitions.

Now close the application and you will be directed to the
previous wizard. On this window select the first option which says 'Configure
Installation' and hit Enter. After this, it will seek information such as the
'System Type' (here you can go with the default option), partition type
(select razorfs), username, password and the root's password. Fill in all the
fields with appropriate values. It will also ask you where you want to install
the Boot loader (grub in this case). Select MBR if you don't want to do dual
boot (not good or this type of setup). After you're done with all of this, the
'Knoppix Installer' will re-appear. Now select the second option from here
which says 'Start Installation' and within a couple of minutes the Live CD
will get installed on your machine.

Using
the Live CD

Suppose, you don't
intend to install the Live CD on the machine and use it as it is. Then all
you have to do is to run the knoppixU command with the sudo prefix:

#sudo knoppixU

This is basically a
shell script which will start the Guest OS with the same kernel on top of
the Host OS. This command will start the machine which will get an IP
address from the DHCP server on the network. But if you want to use 'Nating,'
which means the virtual machine will access the network with a virtual IP
and will reflect the natted IP of the Host OS on the network, then use the
following command:

#sudo knoppixU nat

NOTE: If you want to
access the desktop of the guestOS over VNC remotely then don't use
nating.

Now, when you run this
command. It will show the booting process of the guest OS on the same
window. And within a small period of time a full screen desktop of the
guest OS will appear on the screen. This is slightly buggy as now you
won't be able to access the host OS. Only the guest OS desktop is
visible. So, to solve this problem press Alt+Ctrl+Back space once and the
display will get restarted. Now, you'll again see the desktop of the
host OS.

And when you need to
access the desktop of the guest OS all you have to do is to run vncviewer
with the IP address of the guest machine and you will be able to see its
desktop. You can also access it from remote machine which has the
vncviewer installed.

Installing New Guest

OSs

Install another Linux distro (say RHEL, Debian) on some other partition of
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.

Anindya Roy

Stay connected with us through our social media channels for the latest updates and news!

Follow us: