Changes

Jump to: navigation, search

Building a Xen Guest Domain using Xen-Tools

84 bytes added, 18:52, 29 May 2016
m
Text replacement - "<htmlet>xen<htmlet>" to "<htmlet>xen</htmlet>"
<htmlet>xen</htmlet>  In [[Building a Debian or Ubuntu Xen Guest Root Filesystem using debootstrap]] we looked at manually building a Debian or Ubuntu based Xen guest domain (domU) by manually creating disk images and a configuration file and then using the ''debootstrap'' tool to populate the root filesystem with a base Linux installation. A much easier way to create a guest Xen system is to use a set of tools called ''Xen-Tools''. There purpose of this chapter, therefore, is to provide an overview of Xen-Tools and work step by step trough through the process of creating a bootbale bootable Xen guest domain using these tools.
== Getting Xen-Tools ==
Xen-Tools are available for download from the [http://www.xen-tools.org Xen-Tools.org web site]. Before rushing to this web site to download these tools it is first worth checking if they are available from the repositories for your chosen Linux distribution. This is certain the case for Ubuntu Linux which installs the xen-tools as part of the ''ubuntu-xen-server'' package (if you already have this installed the following command does not need to be run):
<pre>
Edit this file to configure the desired defaults. Note that any of these defaults may be overridden using command-line arguments.
== Specifiy Specify Xen-Tools Installation Location ==
Begin by setting the ''dir = '' directive to the directory into which the tools are to create the Xen guest image files:
<pre>
== Specifying the Xen-Tools Installation Source and Method ==
Next, specify the mechanism to be used to be used to install the base operating system packages of the guest domain's root filesystem via the ''install-method = '' line of the configuration file. For those using Debian or Ubuntu ''debootstrab'' should be specified. For systems which use the Red Hat Package Manager (RPM) such as Red Hat Linux, CentOS and Fedora use ''rpmstrap''.
If the root filesystem is to be copied from a disk location or extracted from a tar file specify the ''copy'' or ''tar'' options respectively in conjunction with the ''install-source = '' line indicating the location of the filesystem or tar file from which to install.
</pre>
Also, the ''accounts'' option can be used if all user accounts on the host are to be copied to the Xen guest system:
<pre>
== Xen Guest Console Settings ==
It Next, it is necessary to configure the console settings for the Xen guest. Choice Choices are as follows:
<pre>
== Options Disk Drive Device Naming ==
Finally the device naming conventions used for the disk drives within the guest operating system may be optionally be defined. Xen-Tools defaults to ''/dev/sda'' based names, but this can be changed to the more recent ''tap:aio'' based ''xvda'' conventions as follows:
<pre>
== Building the Xen Guest Images ==
Now that we have completed the configuration process the next step is to generate the images for the Xen guest. This task is performed using the ''xen-create-image'' tool. This tool takes a wide range of command-line options which can be used to override the settings in a configuration file outlined above, or as an alternative to placing configuration settings in the configuration file. The following example creates the images based on the settings we defined in the Xen-Tools configuration file, avoiding the need to extensive use fo of command-line options:
<pre>
== Booting the Xen Guest System ==
Once the creation process is completed there should be a Xen guest configuration file for the new system located in ''/etc/xen''. In the case of our example this file is called ''XenUbuntu.cfg''. This is atext a text file so feel free to open it in a an editor and review it. Many of the settings defined in the Xen-Tools configuration file should be reflected in this file.
Also the root filesystem and swap images will have been created (and are referenced in the guest configuration file). To review the contents of the root filesystem before attempting to boot the guest domain simply mount the image using the loopback interface. For example, the following command mounts our image at /tmp/mnt:
<pre>
mkir /tmp/mnt
mount -o loop /xen/domain/XenUbuntu/XenUbuntu.img/tmp/mnt
</pre>
All being well, the guest system will now boot. If any boot problems are encountered refer to the [[Solving Common Xen Boot Problems]] chapter of this book.
 
 
<htmlet>xen</htmlet>

Navigation menu