Saturday, December 5, 2009

how to install xen on debian

I deployed my first server based on debian etch and xen worked out of the box.
Follow these steps to install xen on debian etch:

#apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the install xen enabled linux kernel

#reboot

Then adjust the network setting in /etc/xen/xend-config.sxp. Enabling the network bridge by removing the comment:

(network-script network-bridge)

Now install xen tools

#apt-get install xen-tools

Adjust the kernel initrd parameters in /etc/xen-tools/xen-tools.conf to match the once on your system:

#ls /boot/vmlinus*
/b0ot/vmlinus-2.6.18-4-686 /boot/vmlinus-2.6.18-4-xen-686
and
#ls /boot/initrd*
/boot/initrd.image-2.6.18-4-686 /boot/initrd.image-2.6.18-4-686.bak
/boot/initrd.image-2.6.18-4-xen-686

adjust the line

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686



adjust the xen-tools.conf to this settings:

dir = /home/xen
debootstrap = 1
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.



Create a home for all the coming virtual xen guests:

#mkdir /home/xen
#mkdir /home/xen/domains

And now ready to create a virtual machine-guest through this command:

#xen-create-image -hostname=xen.server.com -ip=192.168.1.X -netmask=255.255.255.0 -gatway=192.168.1.1 -passwd

After it i was able to fire up newly created virtual machine with:

#cd /etc/xen/
#/etc/init.d/xend restart
#xm create xen.server.com.cfg -c

Now check when up and running "xm list" or "xentop" can be used to get an overview of what instance are currently running

#xm list

Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----    657.9
xen.server.com                                3      128     1 -b----      8.0

For shutdown the guest run the folloing command
#xm shutdown xen.server.com

No comments:

Post a Comment