The installation and setup of a guest domain involves several procedures. In the following, a first guest domain is installed and all the different tasks to create a first network connection are completed.
To install a guest system, you must provide a root file system in a block device or in a file system image, which needs to be set up. To access this system later, use an emulated console or set up the network connection for this guest. The installation of SUSE Linux into a directory is supported by YaST. The hardware requirements of such a guest are similar to a normal Linux installation.
Domains can share file systems that are mounted read-only from all domains,
such as /usr or /opt. Never share
a file system that is mounted read-write. For sharing writable data among
several guest domains, use NFS or other networked or cluster file systems.
![]() | Starting a Guest Domain |
|---|---|
When you start a guest domain, make sure that the file systems of the guest are not mounted anymore by an installer or by the controlling domain-0. | |
The first thing to do is to create a file system image in which the Linux for the guest is installed:
To create an empty image named guest1 in the
directory /var/tmp/ that is 4
GB size, use the following command:
dd if=/dev/zero of=/var/tmp/guest1 seek=1M bs=4096 count=1
The image is just a big empty file without any information in it. To be able to write files into it, a file system is needed:
mkreiserfs -f /var/tmp/guest1
The command mkreiserfs informs you that this is not a block special device and asks for a confirmation. Enter Y then Enter to continue.
The actual installation is made in a directory. Therefore
the file system image /var/tmp/guest1 must
be mounted to a directory:
mkdir -p /var/tmp/dirinstall mount -o loop /var/tmp/guest1 /var/tmp/dirinstall
![]() | Important |
|---|---|
When you are finished with the installation, unmount
this file system image again. YaST also mounts the
| |
umount /var/tmp/dirinstall/proc umount /var/tmp/dirinstall
To install a guest domain with YaST, you need the previously prepared the file system image for the new guest. Start YaST and select +.
The YaST module for directory installation has several options that should be set according your needs:
Target Directory: /var/tmp/dirinstall
Set this option to the mount point of the file system image to use. The default is usually acceptable.
Run YaST and SuSEconfig at First Boot: Yes
Set this option to . You will be asked for a root password and a first user when starting the guest for the first time.
Create Image: No
The image this creates is just a tar archive of the installation directory. This is not useful here.
Software
Select the type of installation to use. Any of the defaults should be a good start.
Click to start the installation. Depending on the number of packages, the installation takes a while. After the installation has finished, the tls libraries must be moved away:
mv /var/tmp/dirinstall/lib/tls /var/tmp/dirinstall/lib/tls.disabled
Xen uses one of the kernels that are installed in domain-0 to start the guest domain. To be able to use networking in the guest, the modules of this kernel must be available for the guest as well.
cp -a /lib/modules/$(rpm -qf --qf %{VERSION}-%{RELEASE}-xen \
/boot/vmlinuz-xen) /var/tmp/dirinstall/lib/modules
To prevent file system errors, the file system image must to be unmounted after the installation:
umount /var/tmp/dirinstall/proc umount /var/tmp/dirinstall/
It would be possible to build specialized kernels for domain-0 on one hand and for the guest systems on the other hand. The main difference are the hardware drivers that are unneeded in guest systems. Because these drivers are modular and not used in the guest systems, SUSE delivers only one kernel for both tasks.
The easiest way to get a running system quickly is to reuse an
existing root file system, such as the rescue system of SUSE Linux.
Basically, exchange the kernel image and the
device drivers of the virtual block and network devices in this
image. To make this task easier, the script
mk-xen-rescue-img.sh is available in
/usr/share/doc/packages/xen/.
The disadvantage of using the rescue method of constructing a root file system is that the result does not have an RPM database, so you cannot easily add packages using RPM. On the positive side, the result is relatively small but has most of what is needed to get started with networking.
To run the script mk-xen-rescue-img.sh, you
need at least the directory with the rescue image and a
destination location for the resulting image. By default, the directory
resides on the boot DVD in the directory
/boot.
cd /usr/share/doc/packages/xen ./mk-xen-rescue-img.sh /media/dvd/boot /usr/local/xen 64
The first parameter of the script is the directory of the rescue image. The second parameter is the destination of the image file. Optional parameters are the disk space requirements of the newly generated guest domain and the kernel version to use.
The script then copies the image to the new location, replaces the
kernel and several kernel modules, and disables the
tls directory in the
system. As a last step, it generates a configuration file for the
new image in /etc/xen/.