debian

XEN: Install Hypervisor (Dom0) under Debian

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.xen.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>
Enable XL toolstacks
sed -i 's|TOOLSTACK=|TOOLSTACK=xl|g' /etc/default/xen

configure perfomance
http://wiki.xen.org/wiki/Credit_Scheduler
xm sched-credit
xm sched-credit -d www -w 512

# OPTIONAL: sync time
apt-get install -y ntpdate
ntpdate ntp.ubuntu.com
hwclock --systohc
rm /etc/cron.daily/ntpdate

# updae bootstrap
http://www.panticz.de/update_debootstrap

# manually update xen-create-image
wget http://ftp.de.debian.org/debian/pool/main/x/xen-tools/xen-tools_4.3.1-1_all.deb -O /tmp/xen-tools_4.3.1-1_all.deb
dpkg -x /tmp/xen-tools_4.3.1-1_all.deb /tmp/
mv /usr/bin/xen-create-image /usr/bin/xen-create-image.org
cp /tmp/usr/bin/xen-create-image /usr/bin/xen-create-image

# OPTIONAL: enable ip forward in dom0
cp /etc/sysctl.conf /etc/sysctl.conf.org
sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|g' /etc/sysctl.conf

# OPTIONAL: PCI delegation
http://www.panticz.de/xen_pci_delegation

# reboot
reboot

# Ubuntu Xen Dom0
apt-get install -y xen-hypervisor-4.2-amd64 xen-tools

# LINKS
http://wiki.debian.org/Xen
http://wiki.xensource.com/xenwiki/XenBestPractices
http://www.panticz.de/configure_network_bridge
http://www.panticz.de/update_debootstrap
http://www.chrisk.de/blog/2008/12/how-to-run-xen-in-ubuntu-intrepid-without-compiling-a-kernel-by-yourself/
http://wiki.debian.org/Xen
https://help.ubuntu.com/community/Xen

Debian

<?php
$URL="https://raw.githubusercontent.com/panticz/scripts/master/debian/repositories.sh";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

apt-get update && apt-get -y dist-upgrade

Upgrade squeeze to wheezy
sed -i 's|squeeze|wheezy|g' /etc/apt/sources.list
apt-get update
apt-get -y dist-upgrade

fix wget certificate errors
apt-get install -y ca-certificates

Debian Mirrors
http://www.debian.org/mirror/list

Netinstall CD
http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/mini.iso - squeeze netinstall cd

Net install from PXE
mkdir -p /var/lib/tftpboot/debian/squeeze/amd64
wget -q http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux -O /var/lib/tftpboot/debian/squeeze/amd64/linux
wget -q http://ftp.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz -O /var/lib/tftpboot/debian/squeeze/amd64/initrd.gz

cat < /var/lib/tftpboot/pxelinux.cfg/debian-squeeze.conf
label linux
menu label Debian Squeeze installer 64 bit
kernel debian/squeeze/amd64/linux
APPEND initrd=debian/squeeze/amd64/initrd.gz auto url=http://installit.googlecode.com/hg/preseed/debian-preseed.seed locale=en_US console-setup/layoutcode=en netcfg/choose_interface=eth0 debconf/priority=critical DEBCONF_DEBUG=developer --
IPAPPEND 2
EOF

echo "MENU INCLUDE pxelinux.cfg/debian-installer.cfg" >> /var/lib/tftpboot/pxelinux.cfg/default

Net install Debian (boot installer from HDD)
mount /dev/sda1 /mnt/
mount --bind /mnt/boot/ /boot/

mkdir /mnt/boot
grub-install --boot-director=/mnt/boot/ /dev/sda

# get boot files
mkdir /boot/debian-installer/

# stable
wget http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz -O /boot/debian-installer/initrd.gz
wget http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux -O /boot/debian-installer/linux

# testing
wget http://ftp.debian.de/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz -O /boot/debian-installer/initrd.gz
wget http://ftp.debian.de/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux -O /boot/debian-installer/linux

# Ubunut Trusty
wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz -O /boot/debian-installer/initrd.gz
wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux -O /boot/debian-installer/linux

# edit grub config
mv /boot/grub/grub.cfg /boot/grub/grub.cfg.org
cat < /boot/grub/grub.cfg
set timeout=3
menuentry 'Debian Installer' {
linux /boot/debian-installer/linux auto url=http://preseed.panticz.de/preseed/debian-ubuntu-ssh-install.seed priority=critical locale=en_US console-setup/layoutcode=us keyboard-configuration/xkb-keymap=us netcfg/choose_interface=auto
initrd /boot/debian-installer/initrd.gz
}
EOF

# remove user created during installation
userdel -f service

wheezy
http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
http://ftp.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux

pxe
LABEL linux
MENU LABEL Debian Installer 64 bit wheezy [Preseed]
KERNEL debian-installer/wheezy/linux
APPEND initrd=debian-installer/wheezy/initrd.gz auto url=http://installit.googlecode.com/hg/preseed/debian-preseed.seed locale=de_DE console-setup/layoutcode=de netcfg/choose_interface=auto debconf/priority=critical DEBCONF_DEBUG=developer --
IPAPPEND 2

Disable service
update-rc.d apache2 disable

apt-config
apt-config dump

Lenny repository (/etc/apt/sources.list)
deb http://ftp.de.debian.org/debian-archive/debian/ lenny main contrib

Preseed
http://d-i.alioth.debian.org/manual/en.i386/apb.html