Following along a great debian-administration.org article, titled, “Debian Sid gets Xen 3.0”, I set up a minimal Debian Sarge AMD64 install from debian-31r0a-amd64-netinst.iso for use as a Xen development server. The full text of this post contains my step-by-step how-to on my successful installation.
I ran a default netinstall installation, selecting no additional software packages, and used the “multi-user workstation” partitioning scheme, which segregates the /, /usr, /var, /tmp, and /home partitions, with most of the disk using /home, where the Xen virtual machines will reside.
Bang the link below for my full notes!
Michael
———————————————————
Debian Sarge x86-64 Xen Notes – mshuler.devnet.lan
http://www.debian-administration.org/articles/396
Minimal Debian Sarge install from debian-31r0a-amd64-netinst.iso
– default “multi-user workstation” partioning scheme
apt-get install vim
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.6.203.170 mshuler mshuler.devnet.lan
10.6.203.171 mshuler1 mshuler1.devnet.lan
10.6.203.172 mshuler2 mshuler2.devnet.lan
10.6.203.173 mshuler3 mshuler3.devnet.lan
10.6.203.174 mshuler4 mshuler4.devnet.lan
10.6.203.175 mshuler5 mshuler5.devnet.lan
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 10.6.203.170
netmask 255.255.255.128
gateway 10.6.203.129
vi /etc/apt/apt.conf
APT::Default-Release “stable”;
vi /etc/apt/source.list
#deb file:///cdrom/ sarge main
# Stable
deb http://mirror.espri.arizona.edu/debian-amd64/debian/ stable main contrib non-free
deb-src http://mirror.espri.arizona.edu/debian-amd64/debian/ stable main contrib non-free
# Testing
deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free
# Unstable
deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free
# Stable Security
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
vi /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 700
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
Pin: release a=unstable
Pin-Priority: 600
apt-get -t unstable install linux-image-2.6-amd64-k8 xen-hypervisor-3.0-amd64 xen-utils-3.0
(Without installing linux-image, my running kernel was in the REMOVE list)
shutdown -r now (just to be sure we have a good vanilla kernel)
apt-get -t unstable install linux-image-2.6-xen-amd64-k8
update-initramfs -c -k 2.6.16-2-xen-amd64-k8
(Build a new initrd since the xen package does not make one)
cd /boot
ln -s vmlinuz-2.6.16-2-xen-amd64-k8 xen-vmlinuz
ln -s initrd.img-2.6.16-2-xen-amd64-k8 xen-initrd.img
vi grub/menu.lst (add before BEGIN AUTOMAGIC… (if using a /boot partition the kernel will be /xen-3.0…))
title Xen 3.0 / XenLinux 2.6
kernel /boot/xen-3.0-amd64.gz noreboot
module /boot/xen-vmlinuz root=/dev/hda1 ro
module /boot/xen-initrd.img
shutdown -r now (boot into xen dom0! whee!)
—–
Nice! The packages set up the init services, too:
mshuler@mshuler:~$ ls -l /etc/rc*.d/S*xen*
lrwxrwxrwx 1 root root 14 2006-06-13 13:51 /etc/rc2.d/S20xend -> ../init.d/xend
lrwxrwxrwx 1 root root 20 2006-06-13 13:51 /etc/rc2.d/S21xendomains -> ../init.d/xendomains
lrwxrwxrwx 1 root root 14 2006-06-13 13:51 /etc/rc3.d/S20xend -> ../init.d/xend
lrwxrwxrwx 1 root root 20 2006-06-13 13:51 /etc/rc3.d/S21xendomains -> ../init.d/xendomains
lrwxrwxrwx 1 root root 14 2006-06-13 13:51 /etc/rc4.d/S20xend -> ../init.d/xend
lrwxrwxrwx 1 root root 20 2006-06-13 13:51 /etc/rc4.d/S21xendomains -> ../init.d/xendomains
lrwxrwxrwx 1 root root 14 2006-06-13 13:51 /etc/rc5.d/S20xend -> ../init.d/xend
lrwxrwxrwx 1 root root 20 2006-06-13 13:51 /etc/rc5.d/S21xendomains -> ../init.d/xendomains
vi /etc/xen/xend-config.sxp
(cat /etc/xen/xend-config.sxp|egrep -v ‘^#|^$’)
(xend-relocation-server yes)
(xend-relocation-hosts-allow ‘^localhost$’)
(network-script network-bridge) # <-- this is the edit
(vif-script vif-bridge)
(dom0-min-mem 196)
(dom0-cpus 0)
apt-get -t unstable install bridge-utils iproute sysfsutils xen-tools
(there is no amd64 package for libc6-xen per the doc, so I skipped it...)
mkdir /home/xen
vi /etc/xen-tools/xen-tools.conf
(cat /etc/xen-tools/xen-tools.conf|egrep -v '^#|^$')
dir = /home/xen
size = 2Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use EXT3 filesystems
dist = sid # Default distribution to install.
gateway = 10.6.203.129
netmask = 255.255.255.128
passwd = 1
kernel = /boot/xen-vmlinuz
initrd = /boot/xen-initrd.img
mirror = http://ftp.us.debian.org/debian/
xen-create-image --hostname=mshuler1 --ip=10.6.203.171 --passwd
xm create mshuler1.cfg -c
🙂
Log in! To detach from xenconsoled:
Ctrl+]
And with minor changes (hostname, IP) to the above xen-create-image command, I can set up more VM's for the rest of my IP space.
Hope this helps someone (and me to set up more)!
rpm-based distro domU creation example:
dd if=/dev/zero of=/home/xen/domains/mshuler2/disk.img bs=1024k count=2000
dd if=/dev/zero of=/home/xen/domains/mshuler2/swap.img bs=1024k count=128
mkfs.ext3 /home/xen/domains/mshuler2/disk.img
mkswap /home/xen/domains/mshuler2/swap.img
cd /home/xen
rpmstrap –download-only –arch x86_64 centos4 centos4_rpms
(and download the missing ones from the rpm install errors….)
mount -o loop /home/xen/domains/mshuler2/disk.img /mnt/loop/
rpm -ivh –root /mnt/loop centos4_rpms/*.rpm –ignorearch
xm create mshuler2.cfg -c
or from devnet kickstart nfs mount:
mount -t nfs 10.6.203.132:/exports /mnt/nfs/
rpm -ivh –root /mnt/loop/ /mnt/nfs/redhat/rhes-4/RedHat/RPMS/*.rpm –nodeps –ignorearch
conf edits from: http://www.debian-administr…
/etc/init.d/xend:
start)
echo -n "Starting $DESC: "
# addition from: http://www.debian-administr…
modprobe loop max_loop=64
cd /dev && /dev/MAKEDEV loop
# end addition
[ -d "$XENSTORED_RUN_DIR" ] || mkdir -p "$XENSTORED_RUN_DIR"
xend start
await_daemons_up
echo "$NAME."
;;
/etc/xen-tools/xen-tools.conf:
#
# from: http://www.debian-administr…
#
use-ide = 1
On a Xeon server, here are the apt conf bits I used – everything else is pretty much the same 🙂
—–
michael@mshuler-xen:~$ cat /etc/apt/sources.list
# stable
deb http://mirrors.kernel.org/d… stable main contrib non-free
deb-src http://mirrors.kernel.org/d… stable main contrib non-free
# testing
deb http://mirrors.kernel.org/d… testing main contrib non-free
deb-src http://mirrors.kernel.org/d… testing main contrib non-free
# unstable
deb http://mirrors.kernel.org/d… unstable main contrib non-free
deb-src http://mirrors.kernel.org/d… unstable main contrib non-free
# security updates
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free
—–
michael@mshuler-xen:~$ cat /etc/apt/preferences
Package: *
Pin: release o=Debian,a=stable
Pin-Priority: 900
Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 400
Package: *
Pin: release o=Debian,a=unstable
Pin-Priority: 300
Package: *
Pin: release o=Debian
Pin-Priority: -1