The Perfect Xen 3.1.0 Setup For Debian Etch (i386)
Submitted by falko (Contact Author) (Forums) on Sun, 2007-06-03 17:08. :: Debian | Xen | Virtualization
The Perfect Xen 3.1.0 Setup For Debian Etch (i386)
This tutorial provides step-by-step instructions on how to install Xen (version 3.1.0) on a Debian Etch (4.0) system (i386).
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 will use Debian Etch (i386) for both the host OS (dom0) and the guest OS (domU). I will describe how to install Xen from the binary package in chapter 5 and from the sources (chapter 5). In an additional section at the end of chapters 4 and 5 I will also show how to create a virtual local network with virtual machines, with dom0 being the router. Chapters 4 and 5 are mutually exclusive.
This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.
This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
A note on x86_64 systems: I tried to install Xen 3.1.0 on Debian Etch AMD64 as well, but regardless of the method (Xen source install vs. Xen x86_64 binary install), the Xen kernel didn't boot (no error messages, but the boot process was incredibly slow and never finished...).
1 Install The Debian Etch Host System (dom0)
You can overall follow these instructions, but with a few changes:
dom0's FQDN in this example will be server1.example.com, so I specify server1 as Hostname and example.com as Domain name. server1.example.com's IP address will be 192.168.0.100 in this tutorial.
When it comes to the partitioning, I select Manual. I create the following partitions:
When the Debian installer prompts Choose software to install: I make no selection and go on (dom0 should run as few software as possible in order not to be vulnerable to attacks. To the outside world it will be accessible only over SSH.).
2 Preparation Of The Host System
After the base system has been installed and you have removed the installation CD and booted the base system, you should run
apt-get install ssh openssh-server vim-full
to install an SSH server so that you can connect to the system with an SSH client such as PuTTY. The vim-full package makes sure that the vi text editor behaves as expected (without vim-full, you might experience some strange behaviour in the vi text editor).
Because the Debian Etch installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):
Then restart your network:
Then edit /etc/hosts. Make it look like this:
Edit /etc/resolv.conf and add some nameservers:
echo server1.example.com > /etc/hostname
and reboot the system:
shutdown -r now
Both should show server1.example.com.
From now on you can use an SSH client such as PuTTY and connect from your workstation to your Debian Etch server and follow the remaining steps from this tutorial.
Edit /etc/apt/sources.list. Comment out the CD. It should look like this:
to update the apt package database and
to install the latest updates (if there are any).
3 Install Xen
There are two ways to install Xen: install the binary package from the Xen website, or compile Xen and the Xen kernels from the sources.
The first way is easier. In my past Xen tutorials I always recommended to compile Xen from the sources because some features such as quota or iptables were missing in the binary package. This has changed now, so you will most likely find all needed features in the binary package, so I recommend to install the binary package. If you want to be in full control of what features are in the Xen kernel or if you need a special feature that's not in the binary package, you should compile Xen from the sources.
In chapter 4 I describe how to install the Xen binary package which might be easier for beginners. In chapter 5 I describe how to compile and install Xen from the sources. Chapters 4 and 5 are mutually exclusive. Follow either chapter 4 or 5, but not both of them!