The Lumber Cartel, local 42 (Canadian branch)
 |   |   |   |   |   |   | 

Library - Xen - How-to - Install Xen

Installing Xen is a multi-step process that can be intimidating to those who are not familiar with the whole process.  This guide aims to make it straight-forward.

Kernel installation

Use the following commands to install Xen 3.3, and set up the xen system device and network bridge interface:

cd /usr/pkgsrc/sysutils/xenkernel33 && make && make install
This command compiles the Xen 3.3 kernel, which will chainload your Dom0 kernel
cd /usr/pkgsrc/sysutils/xentools33 && make && make install
This command compiles the Xen 3.3 tools, which are required by your Dom0 to manage your DomUs
cd /dev && ./MAKEDEV xen
Unfortunately pkgsrc doesn't take care of this for you automatically, and if you forget to create this device then Xen won't work
echo create > /etc/ifconfig.bridge0
echo !brconfig \$int add wm0 up >> /etc/ifconfig.bridge0
This sets up the bridge interface for your DomU; change "wm0" as you did as per the initial NetBSD 5 installation document; this bridge is needed to set up TAP network interfaces for each DomU

Daemon installation

Use the following commands to configure all the required daemons to start as part of the boot process:

cd /usr/pkg/share/examples/rc.d && cp xend xenbackendd xendomains /etc/rc.d/
Copy the required RC system files to ensure Xen can be started automatically
echo xend=YES >> /etc/rc.conf
The Xen daemon (xend) is the system manager that leverages the libxenctrl library for XM and related Xen system management tools in your Dom0 environment
echo xenbackendd=YES >> /etc/rc.conf
The Xen backend daemon (xenbackendd) provides a direct communication layer for the DomUs to network and block devices; your DomUs depend on it heavily
echo #xendomains=\"domain1\" >> /etc/rc.conf
Although this will do absolutely nothing for now because it begins with an octothorpe ("#") which denotes it as a comment, it's there as a reminder for your convenience later on for how to automatically start Xen domains as part of the boot process (you will need to edit /etc/rc.conf later to update the "xendomains=" line accordingly if you want to configure certain DomUs to start automatically during boot)

Daemon configuration

Modify file "/usr/pkg/etc/xen/xend-config.sxp" using your preferred text editor, mainly to ensure that you can connect to and control your DomU with standard VNC viewer software.  The following lines come from a configuration file on one of our production servers, but with all comments and blank lines removed:

(xend-relocation-server yes)
(xend-relocation-hosts-allow '^localhost$ ^localhost\.localdomain$')
(network-script network-bridge)
(vif-script vif-bridge)
(dom0-min-mem 196)
(enable-dom0-ballooning no)
(dom0-cpus 0)
(vnc-listen '')
(vncpasswd 'password')
(qemu-dm-logrotate-count 9)

Only the final three lines were actually changed from the default version of this configuration file.

The "vnc-listen" parameter enables the VNC server to listen on all IP addresses bound to all NICs (on a production server, you should specify an IP address to listen on; DO NOT specify the IP address configured on your DomU's OS).

The "vncpasswd" parameter is self-explanatory.  You should really change the password to something other than "password" (we use "password" to ensure that the example is clear).

The "qemu-dm-logrotate-count" parameter is set to 10 by default.  The only reason we change this is a matter of personal preference to prevent a minor annoyance with sorting files by extension (which are numbered) because the count begins at 1 rather than 0.

[Previous] [Index] [Next]

[Home] [Profile] [Glossary] [Library] [Resources] [Tools] [FAQ] [Site map] [Contact us]

Copyright © Inter-Corporate Computer & Network Services, Inc.  All rights reserved.
All trademarks are the property of their respective owners.