CentOS DomU under Debian Lenny Dom0

# new
http://www.panticz.de/DomU-CentOS-6
 
# xen-create-image + rinse
# http://serverfault.com/questions/347881/how-to-create-a-centos-xen-domu-on-debian-squeeze-using-xen-create-image
xen-create-image --hostname=foo.example.com --ip=1.2.3.4 --gateway=1.2.3.1 --netmask=255.255.255.0 --install-method=rinse --dist=centos-6 --mirror=http://mirror.centos.org/centos/5/os/x86_64/CentOS/ --arch=amd64 --lvm=vg0
 
xm create -c /etc/xen/foo.example.com.cfg
 
#
# OLD
#
 
# configure domU
DOMAIN_NAME=cenos6
DOMAIN_MAC=00:12:11:21:aa:bb
DOMAIN_RAM=1Gb
DOMAIN_HDD=8Gb
 
# create domU on LVM
xen-create-image --hostname=${DOMAIN_NAME} --dist=centos6 --lvm=vg0 --size=${DOMAIN_HDD} --fs=ext4 --role=udev --memory=${DOMAIN_RAM} --swap=${DOMAIN_RAM} --dhcp --mac=${DOMAIN_MAC} --force
 
 
 
# configure domU
[ -z $DOMAIN_NAME ] && DOMAIN_NAME=centos5
[ -z $DOMAIN_MAC ] && DOMAIN_MAC=00:00:00:00:ce:ce
[ -z $DOMAIN_RAM ] && DOMAIN_RAM=512Mb
[ -z $DOMAIN_HDD ] && DOMAIN_HDD=2Gb
 
# create vm
xen-create-image --hostname=${DOMAIN_NAME} --dhcp --mac=${DOMAIN_MAC} \
--lvm=vg01 --dist=centos-5 --size=${DOMAIN_HDD} --memory=${DOMAIN_RAM} --swap=${DOMAIN_RAM}
 
# rename vm config
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
 
 
mkdir /boot/centos5
wget http://mirror.centos.org/centos/5/os/i386/images/xen/initrd.img
wget http://mirror.centos.org/centos/5/os/i386/images/xen/vmlinuz
 
 
## old 
# post config domU
mount /dev/vg01/${DOMAIN_NAME}-disk /mnt/
# configure hvc0
cp /mnt/etc/init/tty1.conf /mnt/etc/init/hvc0.conf
sed -i 's|tty1|hvc0|g' /mnt/etc/init/hvc0.conf
# configure password
chroot /mnt/ sh -c "echo root:terceS | chpasswd"
# configure locale
chroot /mnt/ sh -c "locale-gen en_US.UTF-8"
echo LANG=en_US.UTF-8 >> /mnt/etc/environment
echo LC_ALL=C >> /mnt/etc/environment
# edit mounts
mv /mnt/etc/fstab /mnt/etc/fstab.org
cat <<EOF> /mnt/etc/fstab 
proc            /proc           proc    defaults        0       0
/dev/xvda1 none swap sw 0 0
/dev/xvda2 / ext3 noatime,nodiratime,errors=remount-ro 0 1
EOF
umount /mnt
 
# Links
http://wiki.centos.org/HowTos/Xen/InstallingCentOSDomU
http://wiki.debian.org/PyGrub