From LedHed's Wiki
Jump to: navigation, search

Ubuntu 10.04 LTS

UPDATE, Theres an easier way!!

http://community.citrix.com/display/xs/Installing+Ubuntu+Server+10.04+%2832bit+and+64bit%29+LTS

Files

Above link in PDF
Installing+Ubuntu+Server+10.04+(32bit+and+64bit)+LTS.pdf
makeubuntu.sh

makeubuntu.sh

#!/bin/bash
## makeubuntu.sh, this creates Ubuntu server 10.04 32 and 64 bit templates on Xenserver 5.6. Net install only
## Author: David Markey <[email protected]>
## This is not an officially supported guest OS on XenServer 5.6

LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal)

if  -z $LENNY  ; then
    echo "Cant find lenny 32bit template, is this on 5.6?"
    exit 1
fi

distro="Ubuntu 10.04"
arches=("32-bit" "64-bit")


for arch in ${arches[@]} ; do
    echo "Attempting $distro ($arch)"
    if  -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal)  ; then
        echo "$distro ($arch)" already exists, Skipping
    else

        NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)")
        xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
         other-config:install-repository=http://archive.ubuntu.net/ubuntu \
         PV-args="-- quiet console=hvc0 partman/default_filesystem=ext3" \
         other-config:debian-release=lucid \
         other-config:default_template=true

        if  "$arch" == "32-bit"  ; then
            xe template-param-set uuid=$NEWUUID other-config:install-arch="i386"
        else
            xe template-param-set uuid=$NEWUUID other-config:install-arch="amd64"
        fi
        echo "Success"
    fi

     

done


echo "Done"

Install

Within XenServer Create a new VM using the "Other Install Media".
Choose an Ubuntu amd64 ISO, i386 ISO's don't seem to work.
NOTE: XenServer 5.5 doesn't support booting from the ext4 file system! During the install process make sure to format the / partition as ext3 or create a separate /boot partition formatted as ext3 so that XenServer can access the boot images.


Make sure to enable OpenSSH either during the install or upon first boot. After the install is finished, boot the new VM. If you didn't enable SSH access during install, now is the time to do it:

sudo apt-get install openssh-server


Modifications to the Guest OS

We need to create console for Xen, the easiest way to do this is to copy tty1.conf to hvc0.conf

Duplicate /etc/init/tty1.conf

cd /etc/init
sudo cp tty1.conf hvc0.conf

Do an inline find and replace with sed

sudo sed -i 's/tty1/hvc0/g' hvc0.conf


Collect Boot Information

We need to gather some info for the next step. Go to the directory containing the grub configuration file:

cd /boot/grub/

Now edit grub.cfg and find the following line (the lines may differ from yours as the kernel may have been updated since this writing). You want the following information:

  • Kernal
  • Boot Arguements
  • Boot Image


It should look something like this:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-21-server' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 96ae5c39-aed3-4fb8-821b-c8f7463d7c76
        linux   /boot/vmlinuz-2.6.32-21-server root=UUID=96ae5c39-aed3-4fb8-821b-c8f7463d7c76 ro   quiet
        initrd  /boot/initrd.img-2.6.32-21-server
}

We are looking for these lines:

linux   /boot/vmlinuz-2.6.32-21-server root=UUID=96ae5c39-aed3-4fb8-821b-c8f7463d7c76 ro   quiet
initrd  /boot/initrd.img-2.6.32-21-server


Kernel

/boot/vmlinuz-2.6.32-21-server

Boot Arguments

root=UUID=96ae5c39-aed3-4fb8-821b-c8f7463d7c76 ro quiet

Boot Image

/boot/initrd.img-2.6.32-21-server


Shutdown the VM

Shut down the VM

halt -p


MakePV Script

This script will automate the process of converting the VM to PV

First you need to get the script to your XenServer Host.
1. Connect to your XenServer Hosts Console (via XenCenter or SSH)
2. move to your home directory

cd ~/

3. Get the makepv.sh script

wget http://wiki.ledhed.net/images/Makepv.sh

4. Now make the script executable

chmod +x Makepv.sh

5. Run the Script

~/Makepv.sh



Installing XS-Tools

The trick to installing XS-Tools on an Ubuntu based VM is to install the the BASH Shell, and reconfigure DASH.

sudo apt-get install bash

Bash was most likely already installed.
Now reconfigure DASH so that its not the default shell.
When asked if you want to install DASH as /bin/sh choose NO

sudo dpkg-reconfigure dash

Now that DASH is not the default shell, you can install XS-Tools from the iso.
In XenCenter Mount the xs-tools.iso as the VM's local DVD-Rom.
Mount the DVD in the Guest VM

sudo mount /dev/xvdd /mnt

now install according to your architecture (Though I've only been able to get this to work on amd64 VM's)

sudo dpkg -i /mnt/Linux/xe-guest-utilities_5.5.0-466_amd64.deb

You now have to make the xe-linux-distribution service run at the correct run level.

sudo update-rc.d -f xe-linux-distribution remove
sudo update-rc.d xe-linux-distribution defaults

You can now reboot or run

sudo /etc/init.d/xe-linux-distribution start

XS-Tools should now be installed and running.


What to do if the VM doesn't boot after running Makepv.sh

xe vm-param-set uuid=<DEVICE_UUID> HVM-boot-policy="BIOS order"
xe vm-param-set uuid=<DEVICE_UUID> PV-bootloader=
xe vm-param-set uuid=<DEVICE_UUID> PV-args=
xe vbd-param-set uuid=<VBD_UUID> bootable=false

You can get <DEVICE_UUID> by:

xe vm-list name-label=<VM_NAME>

You can get the <VBD-UUID> by:

xe vm-disk-list uuid=<DEVICE_UUID>

Upgrading XS-Tools

Mount the DVD in the Guest VM

sudo mount /dev/xvdd /mnt

Find the currently installed XS-Tools

dpkg --get-selections | grep xe-

Remove current XS-Tools

apt-get remove xe-guest-utilities

Install new version of XS-Tools

dpkg -i xe-guest-utilities_5.X.X-XX_amd64.deb

NOTE: make sure to install the right package for your architecture!

Fix the init scripts or it will FAIL!!!!

sudo update-rc.d -f xe-linux-distribution remove
sudo update-rc.d xe-linux-distribution defaults

Reboot and you should have the newest version of XS-Tools.


Graphical Console

The "Desktop" and "Alternate" distributions of Ubuntu boot into X11/Gnome. In order to access the Gnome session from XenCenter (rather than the CLI console) you need to enable VNC on Ubuntu and setup gdm to call vnc on display 0.

NOTE: Most tutorials involving gdm/VNC involve setting up xinetd, but if you have any packages that require openbsd-inetd (like LTSP) then you cannot install xinetd. Here is a link for running vnc as a service from openbsd-inetd.

Files

Reference HowTo in PDF
Ubuntu_10.04_XenServer_HowTo.pdf

XenServer Host Script for making a VM a PV.
Makepv.sh


References

PV / XS-Tools

http://www.bishopbarrington.net/wiki/howto/lucidonxenserver

Graphical Console for PV VM's

https://help.ubuntu.com/community/Xen#GNOME%20as%20domU%20guest

http://community.citrix.com/display/ocb/2008/07/02/Installing+Ubuntu+on+XenServer

http://ubuntuforums.org/showthread.php?t=569451