Starting from 2nd of January until 11th of January, i’ve been documenting about installing Xen with Ubuntu 7.10 a.k.a Gutsy Gibbon as the platform. Before i move further on the topic, i would like to explain a little bit about Xen Virtualization.
"Xen’s support for
virtual machine live migration from one host to another allows workload
balancing and the avoidance of downtime. They have ability to rapidly provision and start a
virtual machine, and increased ability to dynamically respond to faults
by re-booting a virtual machine or moving a virtual machine to
different hardware. Another benefit is the ability to securely separate
virtual operating systems, and the ability to support legacy software
as well as new OS instances on the same computer" from http://en.wikipedia.org/wiki/Xen.
Below are my documentation for Xen Virtualization. it will be divided into 5 part, which is first installing the Xen itself, and then second part is about creating a virtual machine that run Ubuntu7.10, and result in the third column. Next, i also tried to create a virtual machine that run Centos5. So there are documentation on the fourth column and with its result on the fifth column.
—–*—*—–
Below are the steps to install Xen with Ubuntu 7.10 as the platform (dom0):
i) First we have to make sure that you are logged on as root, type
su -
to enter as root. Next, if you want to use vi as your text editor, you should run
apt-get install vim-full
ii) To install Xen, we have to run the following command:
apt-get install-ubuntu-xen-server
Now we have to edit /etc/xen/xend-config.sxp. Run the following command:
vim /etc/xen/xend-config.sxp
* Comment out the (network-script network-dummy)
* Add (network-script network-bridge) above (vif-script vif-bridge)
Next, edit /etc/modules
vim /etc/modules
* Add (loop max_loop=64)
Now take a look at the /boot directory to see which kernels and ramdisks are installed:
ls -l /boot/
* Find (vmlinuz-2.6.22-14-xen) as the Xen kernel and (initrd.img-2.6.22-14-xen) as the ramdisk. We will be needing those while creating virtual machine.
Now we had to create a directory to store virtual machine
mkdir /home/xen
Next, we have to edit /etc/xen-tools/xen-tools.conf
vim /etc/xen-tools/xen-tools.conf
[...]
dir = /home/xen
[...]
dist = gutsy #Default distribution to install
[...]
gateway = 10.20.20.15
netmask = 255.255.255.0
broadcast = 10.20.20.255
[...]
passwd = 1
[...]
mirror = http://de.archive.ubuntu.com/ubuntu/
Now, reboot the system:
shutdown -r now
If the system reboots without problem, then Xen will run without problem.
—–*—*—–
Creating Virtual Machine (domU)
At first, i tried to create first guest domain, ex1_xen, running Gutsy Gibbon with the IP address 10.20.20.238:
xen-create-image –hostname ex1_xen –size 2Gb –swap 256Mb –ide –ip 10.20.20.238 –netmask 255.255.255.0 –gateway 10.20.20.15 –force –dir /home/xen –memory 64Mb –arch i386 –kernel /boot/vmlinuz-2.6.22-14-xen –initrd /boot/initrd.img-2.6.22-14-xen –debootstrap –dist gutsy –mirror http://de.archive.ubuntu.com/ubuntu/ –passwd
To start the virtual machine, run
xm create /etc/xen/ex1_xen.cfg
Run
xm console ex1_xen
Here are the most important Xen commands:
xm create -c /path/to/config – Start a virtual machine.
xm shutdown <name> – Stop a virtual machine.
xm destroy <name> – Stop a virtual machine immediately without shutting it down. It’s as if you switch off the power button.
xm list – List all running systems.
xm console <name> – Log in on a virtual machine.
xm help – List of all commands.
—–*—*—–
Result: I had tried twice to create guest domain that run on Ubuntu7.10, but both attemp had fail. I cannot run the console. It seems the hardware spec for the PC that i used for the installation is not compatible with Xen.
—–*—*——
Eventhough the attempt to create virtual machine that running on Ubuntu7.10 had fail due to certain circumstances, but i proceed with installing virtual machine that run on Centos5. Since, it is a little bit tricky to create a guest domain that run Centos5 on Ubuntu7.10 platform, so i tried it in different way. I copy a centos5 template at the Xen directory on Ubuntu platform. I change the name to ex2_xen. Next , i edit some of it config file
vim /etc/xen/ex2_xen.cfg
*Change hostname (ex2_xen)
Now, to start the virtual machine, type
xm create /etc/xen/ex2_xen.cfg
Run
xm console ex2_xen
—–*—*—–
Result: I succeed to install guest domain that run on Centos5 with platform Ubuntu7.10. The guest domain can run on Ubuntu 7.10