For server function which is not requiring a huge dedicated resources, virtualization become an efficient option. With virtualization we could divide physical hardware nodes to be used by several Virtual Server each having their own function, their own shared resource (dedicated RAM in XEN case).
You could look google up for detailed info on XEN, like these URLs;
http://xen.org Xen opensource site
http://en.wikipedia.org/wiki/Xen Xen on Wikipedia
This article will sums the steps required to install Xen 3.2.0 release inside a Debian Etch Box. The installation will begin on the node with base install + of course ssh server, configure and install the Host Domain (Dom0) and then creates Guest (DomU) using xen-tools from http://xen-tools.org.
After you install base Debian Etch, let’s install ssh server;
apt-get install ssh openssh-server
Debian Etch
This is my partition scheme, taken from; http://www.howtoforge.com/debian_etch_xen_3.1
/boot partiotion 200 MB swap with 4 GB size (my RAM in this machine is 2GB, adjust with your box) / 10 GB the rest is /vserver dan /vserver2 (my machine has 2×250 GB HDD Sata II)
In further production host, I would highly recommend the Node HDD in RAID mode, I prefer RAID 1 or RAID 10 if you have plenty of HDD, simply because it read faster (the smaller the disks size would be better), nothing wrong with software RAID if you don’t have enough budget for a Hardware RAID. And then use LVM based partition for your Guest (phy:lvm) for easier storage management.
These are the final partition scheme;
idayu:/# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 9.2G 1.2G 7.6G 14% / tmpfs 1013M 0 1013M 0% /lib/init/rw udev 10M 60K 10M 1% /dev tmpfs 1013M 0 1013M 0% /dev/shm /dev/sda1 183M 12M 161M 7% /boot /dev/sda4 217G 188M 206G 1% /vserver /dev/sdb1 230G 188M 218G 1% /vserver2
Dom0 (host) Installation
Now we install, configure, and load Xen into the node / host / dom0;
cd /usr/src/ wget http://mirror.lintaswave.net.id/oss-xen/release/3.2.0/xen-3.2.0.tar.gz tar xzvf xen-3.2.0.tar.gz cd /usr/src/xen-3.2.0 install mercurial apt-get install mercurial % # Download the xenifid kernel tree manually, but NOT in xen-3.2.0/ % # because the buildconfig/select-repository script would skip it. hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg
Watch the step carefully, since the 3.2.0 release doesn’t provide patches which make it possible for us to build from the source, read more about it on http://lists.xensource.com/archives/html/xen-users/2008-01/msg00699.html or in the README file (inside the source).
Install another package
apt-get install screen ssh debootstrap python python-twisted iproute bridge-utils libcurl3-dev libssl0.9.7 iproute bridge-utils binutils zlib1g-dev python-dev transfig bzip2 libncurses5-dev x-dev build-essential gettext install gawk apt-get install gawk make dist
This will take quite some time.
cd /usr/src/xen-3.2.0/dist ./install.sh mv /lib/tls /lib/tls.disabled ## do this so your Debian Will load Xen kernel during startup update-rc.d xend defaults 20 21 update-rc.d xendomains defaults 21 20
The Xen kernel will need ramdisk, build the ramdisk, don’t forget to check your /boot directory to make sure the newly created ramdisk exists.
depmod 2.6.18.8-xen apt-get install yaird mkinitrd.yaird -o /boot/initrd.img-2.6.18.8-xen 2.6.18.8-xen
Update grub config and restart your machine; watch that the Machine is now powered by Xen, your Dom0 is ready.
update-grub shutdown -r now idayu:~# uname -a Linux idayu.magnet-id.com 2.6.18.8-xen #1 SMP Sun Feb 17 01:18:25 WIT 2008 i686 GNU/Linux
Create DomU / Virtual Machine / Guest
We are going to use xen-tools;
apt-get install xen-tools
Adjust /etc/xen-tools/xen-tools.conf, modify these entries;
# Insert the Gateway IP Address and Netmask used by your Domu gateway = 117.103.52.xx netmask = 255.255.255.248 # Will ask for root password on DomU creation passwd = 1 # Comment out initrd if you don't need to make different ramdisk for different DomU # kernel = /boot/vmlinuz-2.6.16-2-xen-686 # initrd = /boot/initrd.img-2.6.16-2-xen-686 kernel = /boot/vmlinuz-2.6.18.8-xen # Insert your favorite etch repo mirror = http://debian.indika.net.id/debian/
Now let’s create a DomU using xen-create-image command, the parameter on the command shows the specification of the DomU;
xen-create-image -hostname=tuban.magnet-id.com -size=10Gb -swap=512Mb -ide -ip=117.103.52.61 -netmask=255.255.255.248 -gateway=117.103.52.57 -force -dir=/vserver -memory=128Mb -arch=i386 -kernel=/boot/vmlinuz-2.6.18.8-xen -debootstrap -dist=etch -mirror=http://debian.indika.net.id/debian/ -passwd General Infomation ------- Hostname : tuban.magnet-id.com Distribution : etch Fileystem Type : ext3 Size Information ------ Image size : 10Gb Swap size : 512Mb Image type : sparse Memory size : 128Mb Kernel path : /boot/vmlinuz-2.6.18.8-xen Networking Information -------- IP Address 1 : 117.103.52.xx Netmask : 255.255.255.248 Gateway : 117.103.52.xx WARNING --- Loopback module not loaded and you're using loopback images Run the following to load the module: modprobe loop loop_max=255 Creating swap image: /vserver/domains/tuban.magnet-id.com/swap.img Done Creating disk image: /vserver/domains/tuban.magnet-id.com/disk.img Done Creating ext3 filesystem on /vserver/domains/tuban.magnet-id.com/disk.img Done Installing your system with debootstrap mirror http://debian.indika.net.id/debian/ Done Running hooks Done No role script specified. Skipping Creating Xen configuration file Done Setting up root password Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully All done Logfile produced at: /var/log/xen-tools/tuban.magnet-id.com.log
This will create a DomU using file based (image) storage. The image will be mounted on a loop devices, I read somewhere that this configuration will be risky for the integrity of DomU data, so again, I would not recommend this kind of setup.
After the DomU creation you are going to find the DomU configuration file in /etc/xen/hostname.cfg, in this case is /etc/xen/tuban.magnet-id.com.cfg. Fire up the DomU;
idayu:~# xm create /etc/xen/tuban.magnet-id.com.cfg Using config file "/etc/xen/tuban.magnet-id.com.cfg". Started domain tuban.magnet-id.com
To auto boot the virtual machine during Dom0 startup, make a symlink to the DomU config file inside /etc/xen/auto/
idayu:~# ln -s /etc/xen/tuban.magnet-id.com.cfg /etc/xen/auto/

One Comment
an you can start dom0 ? bridge?