Wednesday, January 07, 2009

Debootstrap Intrepid Server PV DomU at Xen 3.3.1 CentOS 5.2 Dom0 (all 64-bit)

As appears debootstrap RPM developed for Fedora 9 works fine at Xen 3.3.1 CentOS 5.2
Dom0 and provide an option to create Intrepid Server PV Guest via debootstrap
Ubuntu's image in RH's Xen Dom0 environment.
Install F9's rpm then debootstrap would understand non Ubuntu Environment:-

# rpm -ivh debootstrap-1.0.8-1.fc9.noarch.rpm

Prepare LVMs for install:-

# lvcreate -n ubuntu -L12G /dev/vgxen
# lvcreate -n ubuntu-swap -L4G /dev/vgxen
# mke2fs -j /dev/vgxen/ubuntu
# mkswap /dev/vgxen/ubuntu-swap
# mkdir -p /mnt/xen
# mount /dev/vgxen/ubuntu /mnt/xen

Create missing symlink:-

# ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/gutsy/intrepid

Deboostrap new Intrepid Guest:-

# debootstrap --arch=amd64 --include=linux-image-server,grub \
--components=main,universe,multiverse intrepid /mnt/xen \

Once that has finished chroot into the new debootstrapped tree :-

# chroot /mnt/xen
# export LANG=C

Create /etc/fstab:

# cat /etc/fstab
/dev/xvda1 / ext3 defaults 0 1
/dev/xvdb1 none swap defaults 0 0
proc /proc proc defaults 0 0

Create a folder for GRUB menu and update the config

# mkdir -p /boot/grub
# update-grub

Edit /boot/grub/menu.lst
- add "console=hvc0" to both kernel lines (normal and recovery mode)
Setup a getty on the Xen console (hvc0):

# cd /etc/event.d
# cp tty1 hvc0
# sed -i -e "s/tty1/xvc0/g" hvc0

Remove references to the hardware clock; these will cause the DomU to hang:

# update-rc.d -f hwclockfirst remove
# update-rc.d -f hwclock remove
# rm /etc/udev/rules.d/85-hwclock.rules

Configure network interfaces (/etc/network/interfaces):-

# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

Create /etc/hosts file

# cat /etc/hosts localhost IntrepidPVH

Create /etc/hostname file

# cat /etc/hostname

Exit chroot and unmount the filesystem.

# exit
# umount /mnt/xen

Start DomU via profile:-

bootloader = '/usr/bin/pygrub'
memory = 2048
name = "ubuntuPV"
vif = [ 'bridge=eth0' ]
disk = [ 'phy:/dev/vgxen/ubuntu,xvda1,w', 'phy:/dev/vgxen/ubuntu-swap,xvdb1,w' ]

At this point i had to bring /etc/apt/sources.list from remote Intrepid Server installed
on bare metal.Run tasksel and DomU to install Basic Ubuntu Server and OpenSSHserver.

# apt-get update
# apt-get upgrade

1.CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu DomU