this is obsolete doc -- see http://doc.nethence.com/ instead

RHEL/XEN paravirtualized guest 

 

 

centos5x64 skeleton 

Build a guest skeleton, 

mkdir -p /data/guests/centos5x64/
cd /data/guests/centos5x64/
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.7/os/x86_64/images/xen/vmlinuz
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/5.7/os/x86_64/images/xen/initrd.img
dd if=/dev/zero of=centos5x64.disk bs=1024k count=1 seek=10000
dd if=/dev/zero of=centos5x64.disk2 bs=1024k count=1 seek=30000
cat > centos5x64 <<EOF9
name = "centos5x64"
memory = "1024"
kernel = "vmlinuz"
ramdisk = "initrd.img"
#bootloader = "/usr/bin/pygrub"
disk = ['file:/data/guests/centos5x64/centos5x64.disk,xvda,w',
        'file:/data/guests/centos5x64/centos5x64.disk2,xvdb,w']
vif = [ 'vifname=vcentos5x64.0' ]
vcpus = "2"
EOF9

 

 

centos4x64 skeleton 

Build a guest skeleton, 

mkdir -p /data/guests/centos4x64/
cd /data/guests/centos4x64/
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/4.8/os/x86_64/images/xen/vmlinuz
wget ftp://ftp.free.fr/mirrors/ftp.centos.org/4.8/os/x86_64/images/xen/initrd.img
dd if=/dev/zero of=centos4x64.disk bs=1024k count=1 seek=10000
dd if=/dev/zero of=centos4x64.disk2 bs=1024k count=1 seek=30000
cat > centos4x64 <<EOF9
name = "centos4x64"
memory = "1024"
kernel = "vmlinuz"
ramdisk = "initrd.img"
disk = ['file:/data/guests/centos4x64/centos4x64.disk,xvda,w',
        'file:/data/guests/centos4x64/centos4x64.disk2,xvdb,w']
vif = [ 'vifname=vcentos4x64.0' ]
vcpus = "2"
EOF9

 

 

Notes 

Note. quotes are mandatory or you might get e.g., 

Error: name <guestname> is not defined

Note. you might want to force a bridge, 

vifname=...,bridge=eth0

Note. you might want to force a mac address, 

vifname,...,mac=00:16:3e:xx:xx:xx

 

 

Installation methods 

ISO image 

To use the iso as installation media, 

#'file:/data/share/CentOS-5.7-x86_64-bin-1of8.iso,ioemu:hdc:cdrom,r']

Note. centos4 doesn't find the ioemu:hdc cdrom 

 

Hard drive 

Copy the repository or first cdrom image's content to guest's second disk. Use ext3, mounting ext4 on a loop device isn't working on a centos5 dom0 (mount: Operation not supported). 

mkfs.ext3 -F centos4x32.disk2
mkdir loop/
mount -o loop centos4x32.disk2 loop/
cp -R path/to/centos4/* loop/
umount loop/

 

Network 

Note. to use kickstart (change NFS_SERVER accordingly), 

#extra = "ip=dhcp noipv6 ks=nfs:NFS_SERVER:/data/share/centos5x64.core.ks text"

 

Dummy network 

If you can't access the outside world for some reason, use a dummy bridge. On the dom0, 

brctl addbr dummybr0
ifconfig dummybr0 10.1.1.1 netmask 255.255.255.0 up

and use that vif for the guest, 

vif = [ 'vifname=vcentos4x64.0,bridge=dummybr0' ]

 

 

Installation settings 

Launch the guest to start the installation process, 

cd /data/guests/centos5x64/
xm cr centos5x64 -c
#xm cr centos4x64 -c

 

During installation, if you choose FTP installation, e.g., 

site: ftp.free.fr
folder: /mirrors/ftp.centos.org/5.7/os/x86_64
#folder: /mirrors/ftp.centos.org/4.8/os/x86_64

press OK or F12. 

 

Note. the kernel argument for pygrub (by default), 

console=xvc0

 

When prompted for reboot, simply shutdown the guest from the dom0, 

xm shu centos5x64
#xm shu centos4x64

otherwise you'll have to 'xm destroy' it when it prompts for a new install... You can now comment out the kernel and installer ramdisk, 

#kernel= "vmlinuz"
#ramdisk = "initrd.img"

add pygrub instead, 

bootloader = "/usr/bin/pygrub"

Note. it's preferable to use pygrub to make sure "/lib" is in sync with the kernel inside the guest. It's also preferable to make a clean cut separation between dom0 and guests : to enter into guest's single user mode, you do as usual using grub (start the guest with xm create -c do you get there in time before the timeout). 

 

 

Post-installation 

Disable the hardware clock, 

cd /sbin/
ls -l hwclock*
mv hwclock hwclock.dist
touch hwclock
chmod +x hwclock

Note. otherwise we could get that error, 

Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.

 

Disable intel microcode (rhel4), 

chkconfig --list microcode_ctl
chkconfig microcode_ctl off

 

GPM is useless on (xen) serial console, 

service gpm stop
chkconfig --list gpm
chkconfig gpm off

 

Disable smartd (rhel4, 5), 

chkconfig --list smartd
chkconfig smartd off

 

Disable tcp offloading on rhel5

ethtool -k eth0 2>/dev/null| grep on$
ethtool -K eth0 tx off
ethtool -K eth0 sg off
ethtool -K eth0 tso off
#ethtool -K eth0 gso off
#ethtool -K eth0 gro off
cat >> /etc/rc.local <<EOF9

 

echo disabling tcp offloading.
ethtool -K eth0 tx off
ethtool -K eth0 sg off
ethtool -K eth0 tso off
EOF9

 

Disable tcp offloading on rhel4

ethtool -k eth0 2>/dev/null| grep on$
ethtool -K eth0 tx off
ethtool -K eth0 sg off
cat >> /etc/rc.local <<EOF9

 

echo disabling tcp offloading.
ethtool -K eth0 tx off
ethtool -K eth0 sg off
EOF9

 

Remove the freaking mac address from the network configuration, 

cd /etc/sysconfig/network-scripts/
vi ifcfg-eth0
remove HWADDR=...
cd /etc/sysconfig/
find . | grep .bak$ | xargs rm -f

note. makes it easyer to change cards 

apply, 

service network restart