Linux Tutorials
Building Hadoop Clusters On Linux In EC2
Installing And Using Hadoop
Setting Up SSH Keys Using SSH Agents And Tunnels
Creating OpenSSL Certificates and Certificate Authorities
Installing and configuring Xen
IPTables Primer
Linux Basic Bash Scripting

Installing and configuring Xen

Guest domains

Xen guest domains can be stored on disk partitions, images, or NFS. There are web sites available that host downloadable domU images that are easily findable with a quick search. Guest domains can also be installed onto a separate partition or hard drive. Use of NFS stored images allow the image to be stored on network attached storage and mounted remotely. This allows for easy migration of guest domains between physical hosts running Xen.

One way to create Xen images is to install the guest OS onto another disk/partition and then using the dd comand to create an image of the guest operating system. The following commands will create you a 1GB image and a 100MB swap file, mount it and copy your guest install to the image. The dd command creates the files that store the image and swap. The mkfs.ext3 and mkswap prepare the files for their respective use. Then mkdir is used to create mount points for the image and the guest domain OS partition which are then mounted (replace /dev/sdb1 with the correct device). An archival copy cp -a is used to copy all the files preserving ownership, permissions, and timestamps to populate the image file.

# dd if=/dev/zero of=guest.img bs=1024 size=1000000
# dd if=/dev/zero of=guest.swap bs=1024 size=100000
# mkfs.ext3 guest.img
# mkswap guest.swap[BR:] # mkdir /mnt/loop
# mkdir /mnt/guest
# mount -o loop guest.img /mnt/loop
# mount /dev/sdb1 /mnt/guest
# cp -a /mnt/guest/* /mnt/loop

Configuring the domU

When launching guest domains Xen uses a configuration file to store the domU information. Example configuration files are installed in /etc/xen. Make a copy of one of the example config files and edit appropriately. Be sure to set the correct kernel, and amount of memory to allocate to the domU. Also be sure to set a unique name for the domain. Use the vif option to setup the virtual network interface. Xen will attempt to use determine the proper network configuration if the vif field is uncommented but empty. The disk option specifies how to present disks to the guest domain, and the root option sets the root device. Finally the extra option sets the default runlevel.

kernel = "/boot/vmlinuz-"
memory = 512
name = "Guest1"
vif = [ '' ]
disk = [ 'phy:sdc1,sdc1,w' ]
root = "/dev/sdc1 ro"
extra = 4

Starting the domU

The xm command is used to start and access the domU. Use the xm create command to start the domU

# xm create /path/to/config

To list running guest domains

# xm list

Connecting to the guest domain.

# xm console domU_name
Configuring the Xen dom0 <<  1 2 3
New Content

Related Information
Linux Basic Bash Scripting