From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerone Young Subject: Fedora Core 3 & Xen How-To for Beginners Date: Fri, 14 Jan 2005 15:15:36 -0600 Message-ID: <1105737337.3752.19.camel@thinkpad> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-dgzM0CGfyzZok/i/RIUN" Return-path: Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: xen-devel@lists.sourceforge.net List-Id: xen-devel@lists.xenproject.org --=-dgzM0CGfyzZok/i/RIUN Content-Type: text/plain Content-Transfer-Encoding: 7bit For those having troubles install Xen here is a nice simple How-to. This could possibly be added to the Xen Users guide. Attached is an html version. Below is the text version: 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 1. Install Fedora Core 3 on the system: a. On "Installation Type" screen choose "Server" b. 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. c. On "Firewall Configuration" screen DISABLE the firewall and DISABLE SELinux. d. At "Package Group Selection" screen place a check by "Development Tools". Also check any additional package you want to add. e. Go through installation & reboot. 2. Boot into your new Fedora Core 3 system. 3. Install bridge-utils and sysfs-utils rpms. 4. Unpack Twisted-1.3.0.tar.gz 5. cd Twisted-1.3.0 6. python setup.py install 7. ln -s /usr/lib/libidn.so.11 /usr/lib/libidn.so (don't worry if already exists) 8. Unpack xen-2.0.3-src.tgz 9. cp linux-2.6.10.tar.bz2 xen-2.0 10. cd xen-2.0 11. make 12. ./install.sh 13. cp dist/install/etc/init.d/xen* /etc/init.d 14. chkconfig xend on 15. chkconfig xendomains on 16. touch /lib/modules/2.6.10-xen0/modules.dep (This step is needed to create initrd image) 17. mkinitrd /boot/initrd-2.6.10-xen0.img 2.6.10-xen0 18. 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 19. For the grub entry above make sure that "root=" is set to the root partition ("/") that you setup. 20. Also set "dom0_mem" to the amount of physical memory you want for 21. 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 22. Reboot and choose "Xen 2.0.3 (stable)" from Grub menu. 5. Create Fedora 3 Domain > 0 (Xen Virtual Domains) 1. 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). 2. Format partition for root partition ("/") using "mkfs.ext3 /dev/". If making swap then use "mkswap /dev/" to format swap. 3. Mount your newly created for the root partition ("/") to /mnt mount /dev/ /mnt 4. 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} 5. Move tls libraries not supported by Xen: mv /mnt/lib/tls /mnt/lib/tls.disabled 6. touch /lib/modules/2.6.10-xenU/modules.dep 7. Create initrd for xenU kernel: mkinitrd /boot/initrd-2.6.10-xenU.img 2.6.10-xenU 8. 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/ ro" 9. Comment out "extra=" line in the file. 10. To point to your configuration file to the correct partitions change the "disk=" line. disk = [ 'phy:,hda1,w', 'phy:,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. 11. 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 12. Erase all entries in /mnt/etc/modprobe.conf echo > /mnt/etc/modprobe.conf 13. umount /mnt 14. Load new virtual machine: xm create -c vmid= 15. You should now be in your virtual machine :-) 16. Kudzu will prompt you to remove a bunch hardware, remove the hardware. 17. To setup network echo "alias eth0 xen_net" > /etc/modprobe.conf 18. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add the following text: DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=on 19. Edit /etc/sysconfig/network to have: NETWORKING=yes HOSTNAME= 20. ifup eth0 21. Networking will start automatically on boot from now on. 22. 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. 23. For more information see Xen Users guide: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/user.html Authors: Anthony Liguori Jerone Young -- Jerone Young Open Virtualization IBM Linux Technology Center jyoung5@us.ibm.com 512-838-1157 (T/L: 678-1157) --=-dgzM0CGfyzZok/i/RIUN Content-Disposition: attachment; filename=fc3-howto.html Content-Type: text/html; name=fc3-howto.html; charset=UTF-8 Content-Transfer-Encoding: 7bit sd

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

  1. Install Fedora Core 3 on the system:

    1. On "Installation Type" screen choose "Server"

    2. 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.

    3. On "Firewall Configuration" screen DISABLE the firewall and DISABLE SELinux.

    4. At "Package Group Selection" screen place a check by "Development Tools". Also check any additional package you want to add.

    5. Go through installation & reboot.

  1. Boot into your new Fedora Core 3 system.

  2. Install bridge-utils and sysfs-utils rpms.

  3. Unpack Twisted-1.3.0.tar.gz

  4. cd Twisted-1.3.0

  5. python setup.py install

  6. ln -s /usr/lib/libidn.so.11 /usr/lib/libidn.so (don't worry if already exists)

  7. Unpack xen-2.0.3-src.tgz

  8. cp linux-2.6.10.tar.bz2 xen-2.0

  9. cd xen-2.0

  10. make

  11. ./install.sh

  12. cp dist/install/etc/init.d/xen* /etc/init.d

  13. chkconfig xend on

  14. chkconfig xendomains on

  15. touch /lib/modules/2.6.10-xen0/modules.dep (This step is needed to create initrd image)

  16. mkinitrd /boot/initrd-2.6.10-xen0.img 2.6.10-xen0

  17. 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

  18. For the grub entry above make sure that "root=" is set to the root partition ("/") that you setup.

  19. Also set "dom0_mem" to the amount of physical memory you want for

  20. 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

  21. Reboot and choose "Xen 2.0.3 (stable)" from Grub menu.

5. Create Fedora 3 Domain > 0 (Xen Virtual Domains)

  1. 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).

  2. 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.

  3. Mount your newly created for the root partition ("/") to /mnt

    mount /dev/<location of root partition> /mnt

  4. 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}

  5. Move tls libraries not supported by Xen:

    mv /mnt/lib/tls /mnt/lib/tls.disabled

  6. touch /lib/modules/2.6.10-xenU/modules.dep

  7. Create initrd for xenU kernel:
    mkinitrd /boot/initrd-2.6.10-xenU.img 2.6.10-xenU

  8. 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"

  1. Comment out "extra=" line in the file.

  2. 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.

  3. 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

  4. Erase all entries in /mnt/etc/modprobe.conf

echo > /mnt/etc/modprobe.conf

  1. umount /mnt

  2. Load new virtual machine:
    xm create -c <xen configuration> vmid=<some number>

  3. You should now be in your virtual machine :-)

  4. Kudzu will prompt you to remove a bunch hardware, remove the hardware.

  5. To setup network

    echo "alias eth0 xen_net" > /etc/modprobe.conf

  6. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and add the following text:

    DEVICE=eth0

    BOOTPROTO=dhcp

    ONBOOT=on

  7. Edit /etc/sysconfig/network to have:

    NETWORKING=yes

    HOSTNAME=<you choose the name>

  8. ifup eth0

  9. Networking will start automatically on boot from now on.

  10. 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.

  11. For more information see Xen Users guide:

    http://www.cl.cam.ac.uk/Research/SRG/netos/xen/readmes/user/user.html

Authors:
Anthony Liguori <aliguori@us.ibm.com>
Jerone Young <jyoung5@us.ibm.com>

--=-dgzM0CGfyzZok/i/RIUN-- ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt