Hetzner Xen Web Server

# reinstall root server
start hetzner rescue system
 
installimage
Debian
Debian-60-squeeze-64-minimal
HOSTNAME your_host_name 
PART /boot ext2 256M
PART lvm vg0 all
LV vg0 root / ext4 10G
LV vg0 swap swap 4G
#PART swap swap 2G
#PART /boot ext3 256M
#PART / ext3 all
 
ALT + 0 
Yes
 
# install xen
http://www.panticz.de/install-xen
 
 
# create domU
DOMAIN_NAME=www
DOMAIN_IP=178.1.1.1
DOMAIN_GW=178.63.46.213
[ -z ${DOMAIN_RAM} ] && DOMAIN_RAM=512Mb
[ -z ${DOMAIN_HDD} ] && DOMAIN_HDD=8Gb
 
 
#
# Squeze
#
xen-create-image --hostname=${DOMAIN_NAME} \
--netmask=255.255.255.192 --gateway=${DOMAIN_GW} --ip=${DOMAIN_IP} --mac=${DOMAIN_MAC} \
--lvm=vg0 --dist=squeeze --mirror=http://ftp.de.debian.org/debian/ \
--size=${DOMAIN_HDD} --memory=${DOMAIN_RAM} --swap=${DOMAIN_RAM} --role=udev
 
mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
 
# enable smp support
echo "vcpus=$(cat /proc/cpuinfo | grep processor | wc -l)" >> /etc/xen/${DOMAIN_NAME}
 
# add to autostart
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto
 
# pre-configure vm
mount /dev/vg0/${DOMAIN_NAME}-disk /mnt/
# optional: copy kernel modules from dom0 to domU when not debian domU
#cp -a /lib/modules/*-xen-amd64/ /mnt/lib/modules/
chroot /mnt/ sh -c "echo root:terceS | chpasswd"
chroot /mnt/ sh -c "locale-gen en_US.UTF-8"
echo LANG=de_DE.UTF-8 >> /etc/default/locale
umount /mnt
 
# add route on Dom0
route add -host ${DOMAIN_IP} gw ${DOMAIN_IP}
echo "up route add -host ${DOMAIN_IP} gw ${DOMAIN_IP}" >> /etc/network/interfaces 
 
# start vm
xm create -c ${DOMAIN_NAME}
 
# post install in domU
passwd
 
# reconfigure backup repository server
sed -i 's|ftp.uni-bayreuth.de/linux/Debian/debian/|ftp.de.debian.org/debian/|g' /etc/apt/sources.list
apt-get update
 
# update system
apt-get dist-upgrade -y
 
# configure locales
dpkg-reconfigure locales
 
# turning off unnecessary services
grub-mkdevicemap -n
update-rc.d -f ntp remove
 
# install grub on second hdd
grub-install /dev/sdb
 
# OPTIONAL: sensors
apt-get install -y lm-sensors
/usr/bin/yes YES | /usr/sbin/sensors-detect

Links
https://community.hetzner.com/tutorials/install-ubuntu-2004-with-full-disk-encryption
http://wiki.hetzner.de/index.php/Hetzner_Aptitude_Mirror