Installing XEN

From ISPWiki

Jump to: navigation, search

Currently no operating systems provide correct operation of xen "out of the box" ( of DomU under any guest operating system).

This article provides step-by-step instructions on how to install Xen 4.0 manually.


Preliminary notes

Follow the steps below to install Xen on Debian. XEN requires a root that is 5-10 Gb larger than RAM on the server. It is required for Xen to save virtual machines' statuses when booting to the /var/lib/xen/save directory. VPS templates require space as well. If there is a lack of space, some errors may occur when rebooting the server.

Installing Xen

  1. To get started you will need to download the latest version of the software at
  2. Unpack xen-4.0.0.tar.gz
  3. Read the instructions on how to install Xen at|(4.0)

The following is the summary of this instruction:

Installing the required packages

apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif\
texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended pciutils-dev\
mercurial build-essential make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch\
libvncserver-dev libsdl-dev libjpeg62-dev iasl libbz2-dev e2fslibs-dev git-core uuid-dev gcc-multilib

Setting up Xen

cd xen-4.0.0
make install

It may take much time to complete the operation (depending on the Internet and server bandwidth). During the installation process make world will prompt you to complete certain actions, thus we recommend that you stay in the console and press "Enter" when prompted.

Kernel configuration.

Default settings will not work. You install pciutils and find out the drivers that are required for a hard disk and network interface controller.

Open the linux-2.6-pvops.git/drivers/xen/Kconfig file, locate XEN_GNTDEV and disable the BROKEN attribute, otherwise VNC will not work.

Go to build-linux-2.6-pvops_x86_64 and execute:

make menuconfig
  1. Enable all necessary drivers
  2. Enable tunnels support (you should search for TUN)
  3. Enable XEN_GNTDEV
  4. Move loop to the modules (if we want to create a VPS both in LVM and common partition)
  5. Enable NETFILTER_XT_MATCH_PHYSDEV (otherwise iptables will not work)

Set up the kernel:

make all
make install
make modules_install
mkinitramfs -o /boot/initrd.img- # The kernel version may vary

Updating grub

It works with grub only, for grub 2 you need to specify Xen manually.


You may specify the following parameters in the kernel line: dom0_mem=1024M loglvl=all guest_loglvl=all. (Optional)

If you are going to store the VPS in the files (using the loop module), rather than in the LVM partitions, you need to add max_loop=255 into the kernel line, otherwise you won't be able to create more than 8 loop devices.

Configuring the system

If xen_gntdev is a module, specify the followings in /etc/modules

Enable xen automatic start

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

Please, consider that xend must start before xendomains, xendomains must finish before xend, otherwise the server will hang while restarting and stopping. Unfortunately, Xen developers did not specify dependencies in start scripts, thus you should pay special attention to this issue.

To configure bridge, go to the /etc/network/interfaces file in the parameters of your network interface controller and specify:

up /etc/xen/scripts/network-bridge start

To set up XEN specify/uncomment the following lines in the /etc/xen/xend-config.sxp file:

(network-script 'network-bridge bridge=eth0 antispoof=yes')
(vif-script vif-bridge)
(vnc-listen 'XX.XX.XX.XX') # XX.XX.XX.XX - the main IP-address а your server. Default value
(vncpasswd '....')         # random succession. You are likely not to use it.  

Disable unauthorized access from other IP-address:

iptables -P FORWARD DROP

Reboot the server.

Configuring LVM

Enable LVM support

apt-get install lvm2

Create a LVM partition

pvcreate /dev/sda3        # initializing the disk to run in диска LVM
vgcreate VgXen /dev/sda3  # creating volume group named VgXen

Configuring VDSmanager

Download and unpack install.tgz:

mkdir -p /usr/local/ispmgr
tar -x -f install.tgz -z -p -C /usr/local/ispmgr

Set up:

cd /usr/local/ispmgr
touch etc/vdsmgr.conf
sbin/pkgctl -m vdsmgr cache                    # set up cash packages
sbin/pkgctl -m vdsmgr install www              # install and configure apache
# specify a device where we are going to create private data of VPS 
echo "PrivateDiskDir /dev/VgXen" > etc/vdsmgr.conf
# select a virtualization type 
echo "Virtualization xen" >> etc/vdsmgr.conf
rm lib/
ln -s lib/
mkdir -p /xen/template                         # VDSmanager stores VPS templates here 
mkdir -p /xen/conf                             # their configs can be found here

Add to cron (to collect resource usage information):

*/15 * * * * /usr/local/ispmgr/sbin/xenstat    # disk usage 
*/15 * * * * /usr/local/ispmgr/sbin/  # traffic

Create a new VDSmanager user. Name: admin, password: test

echo "User admin teH0wLIpW0gyQ" >> /usr/local/ispmgr/etc/vdsmgr.conf

Now you can access VDSmanager at https://ip/manager/vdsmgr

Was this helpful? Yes | No
Personal tools