The Perfect Xen 3.1.0 Setup For Debian Etch (i386) - Page 5

5 Installing From The Sources

Run the following commands:

apt-get remove exim4 exim4-base lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig

apt-get install iproute bridge-utils python-twisted binutils zlib1g-dev python-dev transfig bzip2 screen ssh debootstrap libcurl3-dev libncurses5-dev x-dev build-essential gettext

 

5.1 Install Xen

Now we download xen-3.1.0-src.tgz from http://www.xensource.com/download/dl_31tarballs.html and unpack it:

cd /usr/src
wget http://bits.xensource.com/oss-xen/release/3.1.0/src.tgz/xen-3.1.0-src.tgz
tar -xvzf xen-3.1.0-src.tgz

Then we compile Xen. This will create one Xen kernel (2.6.18-xen). We have to do this before we can create individual kernels for dom0 and domU. This can take a long time so be patient:

cd xen-3.1.0-src/
make world
make install
mv /lib/tls /lib/tls.disabled

Now Xen is installed. In order to start the Xen services at boot time, do the following:

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

We need a ramdisk for our new Xen kernel, therefore we do the following:

depmod 2.6.18-xen
apt-get install yaird

To create the ramdisk, we run

mkinitrd.yaird -o /boot/initrd.img-2.6.18-xen 2.6.18-xen

The last command creates the ramdisk /boot/initrd.img-2.6.18-xen.

Next we add our new kernel to Grub, our bootloader. We can do this with one simple command:

update-grub

Now reboot the system:

shutdown -r now

At the boot prompt, Grub should now list Xen 3.1.0 / Debian GNU/Linux, kernel 2.6.18-xen as the first kernel and boot it automatically:

If your system comes up without problems, then everything is fine!

You can now use the 2.6.18-xen kernel for both the host system and the virtual machines (as in the Xen binary installation where we also use one kernel for both systems), or you compile a dom0 kernel and a domU kernel (which allows you to create special kernels for each use case) which I will show you in the following two chapters.

 

5.2 Compile A dom0 Kernel

Now we compile a dom0 kernel:

cd /usr/src/xen-3.1.0-src/
make clean
make linux-2.6-xen0-config CONFIGMODE=menuconfig KERNELS="linux-2.6-xen0"

In the kernel comfiguration menu that shows up we enable quota, iptables and the dummy network driver as modules. This is where you enable these modules:

File systems --> [*] Quota support
<M> Old quota format support
<M> Quota format v2 support

Device Drivers ---> Network device support ---> <M> Dummy net driver support

Networking ---> Networking options ---> [*] Network packet filtering (replaces ipchains) ---> Core Netfilter Configuration ---> <M> Netfilter Xtables support (required for ip_tables)

Networking ---> Networking options ---> [*] Network packet filtering (replaces ipchains) ---> IP: Netfilter Configuration ---> <M> IP tables support (required for filtering/masq/NAT)

[*] means: build into the kernel statically.
<M> means: build as a kernel module.

Next we build and install the dom0 kernel:

make linux-2.6-xen0-build
make linux-2.6-xen0-install
depmod 2.6.18-xen0

Afterwards we update GRUB, our bootloader:

update-grub

Now reboot the system:

shutdown -r now

At the boot prompt, Grub should now list the xen0 kernel at the top of the list and boot it automatically. If your system comes up without problems, then everything is fine!

 

5.3 Compile A domU Kernel

Afterwards we compile a kernel for domU (the virtual machines):

cd /usr/src/xen-3.1.0-src/
make clean
make linux-2.6-xenU-config CONFIGMODE=menuconfig KERNELS="linux-2.6-xenU"

In the kernel comfiguration menu that shows up we have to enable quota and iptables as modules (it is important that they are modules. I could not get iptables to work in a virtual machine when I compiled it into the kernel statically!). This is where you enable these modules:

File systems --> [*] Quota support
<M> Old quota format support
<M> Quota format v2 support

Networking ---> Networking options ---> [*] Network packet filtering (replaces ipchains) ---> Core Netfilter Configuration ---> <M> Netfilter Xtables support (required for ip_tables)

Networking ---> Networking options ---> [*] Network packet filtering (replaces ipchains) ---> IP: Netfilter Configuration ---> <M> IP tables support (required for filtering/masq/NAT)

[*] means: build into the kernel statically.
<M> means: build as a kernel module.

After you have left the kernel configuration menu, do the following to build and install the domU kernel:

make linux-2.6-xenU-build
make linux-2.6-xenU-install
depmod 2.6.18-xenU

Share this page:

7 Comment(s)

Add comment

Comments

From: at: 2007-11-19 07:26:51

I installed xen from binary package in Debian Lenny (amd64) according your notes and everything is fine.

The only problem was initrd, where my Raid partitions were not recognized on the boot and therefore the boot failed. The solution was using:

mkinitramfs -o /boot/initrd.img-2.6.18-xen 2.6.18-xen

instead of

mkinitrd.yaird -o /boot/initrd.img-2.6.18-xen 2.6.18-xen

From: at: 2007-09-07 19:32:07

Dear Author

please add the bcc package to your requirements. The hvmloader won´t be compiled without it. It took me an hour or so to discover the missing package.

Best Regards an thx for the Howto

arnageddon 

 

From: at: 2007-10-26 22:33:58

 You say:

> Please make sure that you comment out the initrd line!

When I did this my LVM-based VM's wouldn't boot.

From: at: 2007-11-14 22:14:38

Hi,

 I think there isa newer version of xen utils neccessary, because the XEN-3.1.0 Binary version seems to be to new ...

It also asked a lots of questions about replacing scripts when I installed xen utils via aptitude - and after rebooting it a secound time my xen bridge settings got lost and I wheren't able to start any virtual machine again.

There might be an update of the Howto neccessary ...

 

Thanks 

J. K. S.

From: at: 2007-06-21 10:00:34

some hints for compiling Xen 3.1:

if you wan't the VNC/SDL feature with HVM you need the following packages:

 libjpeg62-dev, libvncserver-dev,  libsdl1.2-dev

and you need to set the following var:

export XENFB_TOOLS=y

and maybe you miss hvmloader: you need the package bcc or it will just not compile.

To check build dependecies there is a nice script:

cd tools/check

./chk build

- Thomas 

PS: see also: http://wiki.xensource.com/xenwiki/BuildConsiderations 

From: at: 2007-07-17 16:31:24

If your root partition is on LVM you need to create an initrd for xen0 kernel as well, run: mkinitramfs -o /boot/initrd.img-2.6.18-xen0 2.6.18-xen0 before update-grub

From: at: 2007-11-01 05:16:08

It seems that the default bnx2 drivers in the Debian Etch kernel are malfunctioning with the network-bridge script in Xen 3.1.

For anyone having issues with the network-bridge and you are using broadcom nics (Dell PowerEdge, etc.) you should install the drivers found here:

http://www.broadcom.com/docs/driver_download/NXII/linux-1.5.10c.zip

Also check out this thread for some talk on the problem:

http://lists.xensource.com/archives/html/xen-users/2007-07/msg00768.html