Virtualization With Xen 3.3.1 On Debian Etch

Version 1.0
Author: Falko Timme

This tutorial provides step-by-step instructions on how to install Xen on a Debian Etch (4.0) system.

Xen lets you create guest operating systems (*nix operating systems like Linux and FreeBSD), so called "virtual machines" or domUs, under a host operating system (dom0). Using Xen you can separate your applications into different virtual machines that are totally independent from each other (e.g. a virtual machine for a mail server, a virtual machine for a high-traffic web site, another virtual machine that serves your customers' web sites, a virtual machine for DNS, etc.), but still use the same hardware. This saves money, and what is even more important, it's more secure. If the virtual machine of your DNS server gets hacked, it has no effect on your other virtual machines. Plus, you can move virtual machines from one Xen server to the next one.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using a Debian Etch system with the hostname server1.example.com and the IP address 192.168.0.100 as the host system (dom0). I will use Debian Etch for the virtual machines (domU) as well.

This guide will explain how to set up image-based virtual machines and also LVM-based virtual machines.

Please note: Xen 3.3.1 comes with the kernel 2.6.18 which is pretty old. If you are using new hardware, the system might not boot anymore due to missing drivers!

 

2 Installing Xen

Before we install Xen, we must install some prerequisites:

apt-get install make gcc libc6-dev zlib1g-dev python python-dev python-twisted bridge-utils iproute libcurl3 libcurl3-dev bzip2 module-init-tools transfig tgif libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev bcc bin86 gawk pciutils-dev mercurial build-essential

Next we download Xen 3.3.1...

cd /usr/src
wget http://bits.xensource.com/oss-xen/release/3.3.1/xen-3.3.1.tar.gz

... and uncompress it:

tar -xvzf xen-3.3.1.tar.gz
cd xen-3.3.1

Now we build it as follows:

make world && make dist

This can take some time, so please be patient. Afterwards, we install Xen:

./install.sh

The output should look as follows:

server1:/usr/src/xen-3.3.1# ./install.sh
Installing Xen from './dist/install' to '/'...
 - installing for udev-based system
 - modifying permissions
All done.
Checking to see whether prerequisite tools are installed...
Xen CHECK-INSTALL  Sun Feb 8 21:22:39 CET 2009
Checking check_brctl: OK
Checking check_crypto_lib: OK
Checking check_curl: unused, OK
Checking check_iproute: OK
Checking check_python: OK
Checking check_python_xml: OK
Checking check_udev: OK
Checking check_xml2: unused, OK
Checking check_zlib_lib: OK
All done.
server1:/usr/src/xen-3.3.1#

Run

mv /lib/tls /lib/tls.disabled

... and create the system startup links for Xen:

update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20

Afterwards we open /etc/modules and make sure that we have the line loop max_loop=64 in it (this step is needed only if you want to create image-based virtual machines - you can skip it if you want to create LVM-based virtual machines):

vi /etc/modules
[...]
loop max_loop=64

Now take a look at the /boot directory:

ls -l /boot/
server1:/usr/src/xen-3.3.1# ls -l /boot/
total 15546
-rw-r--r-- 1 root root   71818 2007-03-26 18:32 config-2.6.18-4-486
-rw-r--r-- 1 root root   66264 2009-02-08 21:21 config-2.6.18.8-xen
drwxr-xr-x 2 root root    1024 2008-12-14 00:07 grub
-rw-r--r-- 1 root root 4845777 2008-12-14 00:04 initrd.img-2.6.18-4-486
drwx------ 2 root root   12288 2008-12-13 23:59 lost+found
-rw-r--r-- 1 root root  716728 2007-03-27 00:39 System.map-2.6.18-4-486
-rw-r--r-- 1 root root  752541 2009-02-08 21:21 System.map-2.6.18.8-xen
-rw-r--r-- 1 root root 1220128 2007-03-27 00:39 vmlinuz-2.6.18-4-486
-rw-r--r-- 1 root root 1541626 2009-02-08 21:21 vmlinuz-2.6.18.8-xen
-rw-r--r-- 1 root root  433689 2009-02-08 21:14 xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 2009-02-08 21:22 xen-3.3.gz -> xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 2009-02-08 21:22 xen-3.gz -> xen-3.3.1.gz
lrwxrwxrwx 1 root root      12 2009-02-08 21:22 xen.gz -> xen-3.3.1.gz
-rw-r--r-- 1 root root 6180789 2009-02-08 21:14 xen-syms-3.3.1
server1:/usr/src/xen-3.3.1#

As you see, there's a new kernel, 2.6.18.8-xen, but no ramdisk for it; therefore we build one...

depmod 2.6.18.8-xen
update-initramfs -c -k 2.6.18.8-xen

... and update our bootloader:

update-grub

Then reboot the system:

reboot

Run

uname -r

and your new Xen kernel should show up:

server1:~# uname -r
2.6.18.8-xen
server1:~#
 

3 Installing xen-tools

We will use xen-tools to create virtual machines. xen-tools make it very easy to create virtual machines - please read this tutorial to learn more: https://www.howtoforge.com/xen_tools_xen_shell_argo. We don't install the xen-tools package from the Debian Etch repository (because it is quite old), but directly from the repository of the developer - that way we get the newest version. Open /etc/apt/sources.list...

vi /etc/apt/sources.list

... and add the following line:

[...]
deb     http://apt.steve.org.uk/etch etch main non-free contrib
[...]

Then run...

wget -q http://apt.steve.org.uk/apt-key.gpg -O- | apt-key add - && apt-get update

... and install xen-tools:

apt-get install xen-tools
Share this page:

2 Comment(s)