Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: How to set up Xen 3.0 from binaries in Ubuntu 6.06

  1. #1
    Join Date
    Feb 2005
    Location
    Iceland
    Beans
    12

    How to set up Xen 3.0 from binaries in Ubuntu 6.06

    This particular way of installing and configuring Xen is just the path of least resistance for me. There are
    many other possible ways of configuring the system.

    1. Install a clean base server system.
    Setup Ubuntu like you normally would. I have created 3 partitions on hda, but you can do it any way you like.
    Just keep your differences in mind when you edit the config files.

    hda1 is swap
    hda2 is 2 GB and mounted as /
    hda3 is the rest of the disk and mounted as /xen-images

    2. Update the system and install Xen
    2.1. Install Xen and configure it
    Open a root shell so you don't have to type sudo for every command.
    Code:
    sudo -s
    Update the system and install nessecary packages.
    Code:
    apt-get update 
    apt-get upgrade
    apt-get install iproute python python-twisted bridge-utils debootstrap
    Download and extract the Xen 3.0 tarball from http://www.xensource.com/xen/downloads/
    Code:
    tar xvf xen-3.0.1-install-x86_32.tgz
    cd xen-3.0.1-install
    ./install.sh
    Check for error messages - it should say OK to all.
    Next we create modules.dep and map files for the new kernel. (see /lib/modules for the correct kernel version)
    Code:
    /sbin/depmod -a 2.6.16-xen
    Edit /etc/mkinitramfs/modules and append the following line:
    Code:
    loop max_loop=64
    If you run out of loop devices later just increase max_loop and rebuild the initrd.
    Create an initrd image. Use the same version number as before.
    Code:
    cd /boot
    mkinitramfs -o initrd.img-2.6.16-xen 2.6.16-xen
    Edit /boot/grub/menu.lst placing the following lines before the Automagic section
    Code:
    title Xen 3.0 / XenLinux 2.6 
    kernel /boot/xen-3.gz 
    module /boot/vmlinuz-2.6-xen root=/dev/hda2 ro
    module /boot/initrd.img-2.6.16-xen
    Make Xen start up and autostart selected guests when the system starts up. xend must start before,
    and must be stopped after xendomains.
    Code:
    update-rc.d xend start 30 2 3 4 5 . stop 31 0 1 6 .
    update-rc.d xendomains start 31 2 3 4 5 . stop 30 0 1 6 .
    Disable Thread-Local Storage (remember to check this after every update)
    Code:
    mv /lib/tls /lib/tls.disabled
    2.2. The following workarounds may not be required later, but I had to do them.
    Rename xen-backend.rules
    Code:
    mv /etc/udev/rules.d/xen-backend.rules /etc/udev/rules.d/92-xen-backend.rules
    To make sure that /var/run/xenstored and /var/run/xend exist.
    Edit /etc/init.d/xend and insert the following lines after the check for /proc/xen/capabilities
    Code:
    if [ ! -d /var/run/xend ] ; then
        mkdir -p /var/run/xend
    fi
    
    if [ ! -d /var/run/xenstored ] ; then
        mkdir -p /var/run/xenstored
    fi
    Edit /etc/init.d/xendomains and change the LOCKFILE line to read
    Code:
    LOCKFILE=/var/lock/xendomains
    2.3. All done for this part so reboot.
    When the system is back up try the following command to verify that everything is ok.
    Code:
    xm list
    You should see something similar to this:
    Code:
    Name                              ID Mem(MiB) VCPUs State  Time(s)
    Domain-0                           0      463     1 r-----    42.3
    3. Configuring the guest domains
    3.1. Create disk images and bootstrap them
    Create a mountpoint for the images.
    Code:
    mkdir /xen-images/mnt
    Create a 1 GB image file and 500 MB swap file, for larger images increase count.
    Code:
    dd if=/dev/zero of=/xen-images/guest_base.img bs=1024k count=1000<br/>
    dd if=/dev/zero of=/xen-images/guest_base-swap.img bs=1024k count=500
    Change permissions for the image files. No one should have access to your Domain-0 computer since that
    would compromise security for all of the guest domains, but this is a good idea anyway and doesn't affect Xen.
    Code:
    chmod 640 /xen-images/guest_base*
    Format guest_base.img as ext3 and then format guest_base-swap.img as swap.
    When it says "/xen-images/guest_base.img is not a block special device." answer yes to proceed anyway.
    Code:
    mkfs.ext3 /xen-images/guest_base.img
    mkswap /xen-images/guest_base-swap.img
    Mount the guest image and bootstrap it.
    You should replace http://archive.ubuntu.com/ubuntu/ with a mirror that is closer to you.
    Code:
    mount -o loop /xen-images/guest_base.img /xen-images/mnt<br/>
    debootstrap --arch i386 dapper /xen-images/mnt http://archive.ubuntu.com/ubuntu/
    Copy your /etc/apt/sources.list to the new image.
    Code:
    cp /etc/apt/sources.list /xen-images/mnt/etc/apt/
    Copy the kernel modules.
    Code:
    cp -dpR /lib/modules/2.6.16-xen /xen-images/mnt/lib/modules/
    Disable Thread-Local Storage.
    Code:
    mv /xen-images/mnt/lib/tls /xen-images/mnt/lib/tls.disabled
    Configure networking for the guest /xen-images/mnt/etc/network/interfaces
    Code:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    # Uncomment this and configure after the system has booted for the first time
    #auto eth0
    #iface eth0 inet static
    #        address 192.168.0.101
    #        netmask 255.255.255.0
    #        broadcast 192.168.0.255
    #        gateway 192.168.0.1
    #        dns-nameservers 192.168.0.1
    Create /xen-images/mnt/etc/hosts and make it look like this.
    Code:
    127.0.0.1       localhost localhost.localdomain
    127.0.0.1       guest
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    Create /xen-images/mnt/etc/hostname
    Code:
    echo guest > /xen-images/mnt/etc/hostname
    Edit /xen-images/mnt/etc/fstab so it looks like this.
    Code:
    proc            /proc       proc    defaults    0 0
    /dev/hda1       /           ext3    defaults,errors=remount-ro    0 1
    /dev/hda2       none        swap    sw          0 0
    Unmount the image.
    Code:
    umount /xen-images/mnt
    If you get this warning "umount: /xen-images/mnt: device is busy" don't worry, it's not important.

    3.2. Boot up the base image to finalize the configuration
    Create a config file for the guest /etc/xen/baseimage
    Code:
    #  -*- mode: python; -*-
    kernel = "/boot/vmlinuz-2.6.16-xen"
    ramdisk = "/boot/initrd.img-2.6.16-xen"
    memory = 128
    name = "baseimage"
    vif = ['bridge=xenbr0']
    disk = ['file:/xen-images/guest_base.img,hda1,w','file:/xen-images/guest_base-swap.img,hda2,w']
    ip = "192.168.0.101"
    netmask = "255.255.255.0"
    gateway = "192.168.0.1"
    hostname = "baseimage"
    root = "/dev/hda1 ro"
    extra = "4"
    Start the guest.
    Code:
    xm create baseimage -c
    Login as root and set the root password.

    Enable shadow passwords.
    Code:
    shadowconfig on
    Create a backup of /etc/network/interfaces
    Code:
    cp /etc/network/interfaces /etc/network/interfaces.bak
    Edit /etc/network/interfaces and put in correct values so you can access the Internet.

    Start networking.
    Code:
    ifup -a
    Install packages (add ubuntu-desktop and more if you want).
    Code:
    apt-get update
    apt-get install ubuntu-base configure-debian openssh-server
    Disable Thread-Local Storage if it has been updated.
    Code:
    mv /lib/tls /lib/tls.disabled
    Configure the system any way you like, I recommend that you try every menu item.
    You should do utils->console-data before utils->console-common.
    Code:
    configure-debian
    Make /etc/sudoers writable.
    Code:
    chmod 660 /etc/sudoers
    Add the new user you created to /etc/sudoers

    Fix permissions for /etc/sudoers
    Code:
    chmod 440 /etc/sudoers
    Stop networking.
    Code:
    ifdown -a
    Replace /etc/network/interfaces with the backup copy.
    Code:
    mv /etc/network/interfaces.bak /etc/network/interfaces
    You are now done setting up the base image so shut it down.

    4. Creating your first guest domain
    Make a copy of the base guest images.
    Code:
    cp /xen-images/guest_base.img /xen-images/guestdom1.img
    cp /xen-images/guest_base-swap.img /xen-images/guestdom1-swap.img
    Rename /etc/xen/baseimage
    Code:
    mv /etc/xen/baseimage /etc/xen/guestdom1
    Edit /etc/xen/guestdom1 and change name, disk and hostname to the following values.
    Code:
    name = "guestdom1"
    disk = ['file:/xen-images/guestdom1.img,hda1,w','file:/xen-images/guestdom1-swap.img,hda2,w']
    hostname = "guestdom1"
    You will want to change the following files for each new guest you create.
    • /etc/hostname
    • /etc/hosts
    • /etc/network/interfaces


    To make the guest start up automatically and make Domain 0 wait for it before shutting down.
    Code:
    ln -s /etc/xen/guestdom1 /etc/xen/auto/
    Or if you want to start and stop the guest manually.
    Code:
    xm create guestdom1
    For further information check the Xen Documentation

    References:
    http://www.howtoforge.com/perfect_xe..._debian_ubuntu
    https://wiki.ubuntu.com/XenOnUbuntuBinaryInstall
    http://www.ubuntuforums.org/showthread.php?t=178027

    Other points of interest:
    https://wiki.ubuntu.com/XenVirtualMa...OnUbuntuDapper
    Last edited by cyberloon; June 18th, 2006 at 02:24 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    Malmö, Sweden
    Beans
    42
    Distro
    Ubuntu 6.06

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    very well explained and comprehensive guide!!

    THANKS ALOT

  3. #3
    Join Date
    Apr 2006
    Beans
    6

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    Well, I tried your how to and at the point where you tell us to reboot, I did and I got the following error...

    kernel /boot/xen-3.gz
    Error 15: file not found

    I'm at a loss. xen-3.gz is in the boot directory.
    Last edited by Alethos; June 17th, 2006 at 05:22 AM.

  4. #4
    Join Date
    Feb 2005
    Location
    Iceland
    Beans
    12

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    Hmmm. Is /boot on a separate partition?

  5. #5
    Join Date
    Apr 2006
    Beans
    6

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    Yes I seperated out /boot from / ... habit I guess. Should I rebuild with just 1 partition (for /boot + /). It's no big deal...I don't have any data i need to save or anything.

  6. #6
    Join Date
    Feb 2005
    Location
    Iceland
    Beans
    12

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    Try to put /boot and / on the same partition. I had this trouble once and that solved it for me.

  7. #7
    Join Date
    Apr 2006
    Beans
    6

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    Ok, i'll rebuild and give it another shot...thanks.

  8. #8
    Join Date
    May 2006
    Beans
    3

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    I get to the reboot, but it drops me to a shell. It seems to not support sata drives on the ich7. The only solution I found was to use xen 2.07, which isn't a option for me.

  9. #9
    Join Date
    Feb 2005
    Location
    Iceland
    Beans
    12

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    You might want to have a look at https://wiki.ubuntu.com/XenVirtualMa...OnUbuntuDapper and compile your own kernel.

  10. #10
    Join Date
    Apr 2006
    Beans
    6

    Re: How to set up Xen 3.0 from binaries in Ubuntu 6.06

    I rebuilt partition scheme, reinstalled and followed your how to. Once again at the reboot point here is what I see:
    Code:
    Begin: Running /scripts/local-premount...
    Done.
    modprobe: FATAL: could not load /lib/modules/2.6.16-xen/modules.dep: no such file or directory
    
    mount: mounting /dev/hda1 on /root failed: no such device
    Begin: running /scripts/local-bottom...
    Done.
    Done.
    Begin running /scripts/init-bottom...
    mount: mounting /root/dev on /dev/static/dev failed: no such file or directory
    Done.
    mount: mounting /sys on /root/sys failed: no such file or directory
    mount: mounting /proc on /root/proc failed: no such file or directory
    target filesystem doesn't have /sbin/init
    
    Busybox v1.01..............................
    
    /bin/sh: can't access tty; job control turned off
    #
    That's all the errors i could see on screen...where to go from here?

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •