Friday, May 18, 2007

Xen Installation in debian etch

Install Xen first

#apt-get update
#apt-get install xen-hypervisor-3.0.3-1-i386 xen-utils-3.0.3-1
#apt-get install linux-image-2.6.18-4-xen-686

give the version no according to you deb repository.

edit /etc/xen/xend-config.sxp
uncomment this two line
(network-script network-bridge)
(vif-script vif-bridge)

Install tools for xen
#apt-get install bridge-utils iproute sysfsutils libc6-xen xen-tools

Create a directory
#mkdir /home/xen

edit /etc/xen-tools/xen-tools.conf

here is my sample config file
(Here I am showing only uncomment part)
dir = /home/xen
debootstrap = 1
# Disk and Sizing options.
size = 1Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
# noswap = 1 # Don't use swap at all for the new system.
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = full # Specify sparse vs. full disk images.

# Networking setup values.

# Uncomment and adjust these network settings if you wish to give your
# new instances static IP addresses.
gateway =
netmask =
# Uncomment this if you wish the images to use DHCP
# dhcp = 1

# Uncomment the following line if you wish to interactively setup
# a new root password for images.
passwd = 1

# 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

# The default mirror for debootstrap which can be used to install
# Debian Sid, Sarge, and Etch.
mirror =

To create an image (here I am showing with debootstraping)
#xen-create-image --hostname=test --ip= --passwd
it will ask for the root passwd after finish the debootstrap.

edit /etc/xen/test.cfg

check the kernel version is correct for your system
kernel = '/boot/vmlinuz-2.6.18-4-xen-686'
ramdisk = '/boot/initrd.img-2.6.18-4-xen-686'

xen-tools generate the disk sda for me. Later I change it to hda
root = '/dev/hda1 ro'
disk = [ 'file:/home/xen/domains/test/disk.img,hda1,w', 'file:/home/xen/domains/test/swap.img,hda2,w' ]

check you ip
if = [ 'ip=' ]

To start the vm
#xm create test.cfg -c

it will start to boot (simple output)
checking file systems...fsck 1.40-WIP (14-Nov-2006)
Setting kernel variables...done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...done.
INIT: Entering runlevel: 2
Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
* Not starting internet superserver: no services enabled.
Starting OpenBSD Secure Shell server: sshdNET: Registered protocol family 10
lo: Disabled Privacy Extensions
IPv6 over IPv4 tunneling driver
Starting periodic command scheduler: crond.

Debian GNU/Linux 4.0 test tty1

test login:

or use
file-->open Domain File
and select the /etc/xen/test.cfg

Here is the nmap output for ip
Interesting ports on test (
Not shown: 1696 closed ports
22/tcp open ssh
MAC Address: 00:16:3E:1F:8F:58 (Xensource)
Device type: general purpose
Running: Linux 2.6.X
OS details: Linux (X86)
Uptime: 198.839 days (since Tue Oct 31 15:09:34 2006)
Network Distance: 1 hop

Now I can ssh to my
#debian:/home/salahuddin# ssh root@
root@'s password:
Last login: Fri May 18 05:50:41 2007
Linux test 2.6.18-4-xen-686 #1 SMP Mon Mar 26 21:49:04 UTC 2007 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
test:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3E:15:BC:3F
inet addr: Bcast: Mask:
inet6 addr: fe80::216:3eff:fe15:bc3f/64 Scope:Link
RX packets:92 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15420 (15.0 KiB) TX bytes:5239 (5.1 KiB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)


Broadcast message from root@test (ttyp0) (Fri May 18 06:16:58 2007):

The system is going down for system halt NOW!
test:~# Connection to closed by remote host.
Connection to closed.

Change your kernel path and disk config according to your system.
First time I tried with image = sparse in /etc/xen-tools/xen-tools.conf but it did not work for me.
Later I give image = full.

for more doc:

No comments: