InstallingXenOnFedoraCore3
Setting up Fedora Core 3 w/ Xen
1. Getting Started
You should start with a machine you're willing to dedicate. If
you're not dedicating the machine to Xen then you'll have to make
adjustments as you go.
> You also need the Fedora Core 3 CDs or DVD.
2. Overview
This is intended as easy guide for getting Xen & Fedora 3 working together for those having problems getting them working together.
3. Packages
You need to start with a copy of xen-2.0.3, Twisted-1.3.0, linux-2.6.10, bridge-utils, and sysfs-utils.
Web Locations of packages:
* xen-2.0.3-> http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-2.0.3-src.tgz
* Twisted-1.3.0 -> http://twistedmatrix.com/downloads/Twisted-1.3.0.tar.gz
* linux-2.6.10 -> http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2
* bridge-utils -> http://mirrors.kernel.org/fedora/core/3/i386/os/Fedora/RPMS/bridge-utils-1.0.4-4.i386.rpm
* sysfs-utils -> http://mirrors.kernel.org/fedora/core/3/i386/os/Fedora/RPMS/sysfsutils-1.2.0-1.i386.rpm
4. Steps to Create Domain 0
- Install Fedora Core 3 on the system:
- On "Installation Type" screen choose "Server"
- On "Disk Setup" screen allocate about 10GB for your root partition ("/"). Optionally allocate about 1GB for swap partition. Remember you will need to leave space for partitions for other domains.
- On "Firewall Configuration" screen DISABLE the firewall and DISABLE SELinux.
- At "Package Group Selection" screen place a check by "Development Tools". Also check any additional package you want to add.
- Go through installation & reboot.
- Boot into your new Fedora Core 3 system.
- Install bridge-utils and sysfs-utils rpms.
-
# tar -zxvf Twisted-1.3.0.tar.gz
># cd Twisted-1.3.0
# python setup.py install
># ln -s usr/lib/libidn.so.11 /usr/lib/libidn.so (don't worry if already exists)
># tar -zxvf xen-2.0.3-src.tgz
# cp linux-2.6.10.tar.bz2 xen-2.0
># cd xen-2.0
# make
># .install.sh
># cp distinstall/etc/init.d/xen* /etc/init.d
># chkconfig xend on
# chkconfig xendomains on
># touch lib/modules/2.6.10-xen0/modules.dep (This step is needed to create initrd image)
># mkinitrd boot/initrd-2.6.10-xen0.img 2.6.10-xen0
> - Add this to your grub configuration file (/boot/grub/grub.conf) :
title Xen 2.0.3 (stable)
>kernel boot/xen.gz dom0_mem=131072 console=vga
>module boot/vmlinuz-2.6.10-xen0 root=/dev/hda1 ro console=tty0
>module boot/initrd-2.6.10-xen0.img - For the grub entry above make sure that "root=" is set to the root partition ("/") that you setup.
- Also set "dom0_mem" to the amount of physical memory you want for
- Use fdisk to create new partitions for other virtual domains that you are going to want to create. You can also set up your partitions under LVM. See instructions from the Xen User Manual for more information. http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/user.html
- Reboot and choose "Xen 2.0.3 (stable)" from Grub menu.
5. Create Fedora 3 Domain > 0 (Xen Virtual Domains)
- Create 2 new partitions for virtual machine. One will be for the root partition ("/") ( this needs to be the about same size as your current Fedora partition 10GB) , the other will be a swap partition for the virtual machine (this partition is optional).
- Format partition for root partition ("/") using "mkfs.ext3 /dev/<location of root partition>". If making swap then use "mkswap /dev/<location of swap partition>" to format swap.
- Mount your newly created for the root partition ("/") to /mnt mount /dev/<location of root partition> /mnt
- Your then going to copy your current Fedora installation to
the root partition ("/") of the new Xen virtual domain:
>cp -ax {root,dev,var,etc,usr,bin,sbin,lib} /mnt
>mkdir mnt/{proc,sys,home,tmp} - Move tls libraries not supported by Xen: mv /mnt/lib/tls /mnt/lib/tls.disabled
- touch /lib/modules/2.6.10-xenU/modules.dep
- Create initrd for xenU kernel:
>mkinitrd boot/initrd-2.6.10-xenU.img 2.6.10-xenU - Create a new Xen virutal domain configuration file. Make a
copy of file /etc/xen/xmexample2 and place it in /etc/xen/. In that
copy important to make sure to have the following lines set:
kernel="/boot/vmlinuz-2.6.10-xenU"
>ramdisk="boot/initrd-2.6.10-xenU.img"
>root="dev/<location of root partition> ro" - Comment out "extra=" line in the file.
- To point to your configuration file to the correct partitions change the "disk=" line. disk = [ 'phy:<location of root>,hda1,w', 'phy:<location of swap>,hda2,w' ] This is an list of disk that you want the virtual domain to see and what you want to the virtual domain to see them as. So 'phy:hda5,hda1,w', reads that I want physical partition hda5 to be seen by the virtual domain as hda1 and the virtual domain will have read-write access to it.
-
Edit /mnt/etc/fstab to point to proper partitions as
specified in your Xen virtual domain configuration. It should look
something like:
/dev/hda1 / ext3 defaults 1 1
>none dev/pts devpts gid=5,mode=620 0 0
>none dev/shm tmpfs defaults 0 0
>none proc proc defaults 0 0
>none sys sysfs defaults 0 0
>dev/hda2 swap swap defaults 0 0
> - Erase all entries in /mnt/etc/modprobe.conf
- echo > /mnt/etc/modprobe.conf
- umount /mnt
- Load new virtual machine:
>xm create -c <xen configuration> vmid=<some number> - You should now be in your virtual machine :-)
- Kudzu will prompt you to remove a bunch hardware, remove the hardware.
- To setup network echo "alias eth0 xen_net" > /etc/modprobe.conf
- Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add the following text:
DEVICE=eth0
>BOOTPROTO=dhcp
ONBOOT=on
> - Edit /etc/sysconfig/network to have:
NETWORKING=yes
>HOSTNAME=<you choose the name> - ifup eth0
- Networking will start automatically on boot from now on.
- It's a little messy, but once you get things configured nicely you can create an image and copy it for other Xen virtual domains.
- For more information see Xen Users guide: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/user.html
>Anthony Liguori <aliguori@us.ibm.com>
Jerone Young <jyoung5@us.ibm.com>