XenServer/DDK

From Omnia
Jump to navigation Jump to search

DDK

Installation

  1. Download Extract the xvda from the DDK ISO (ddk.iso)
  2. Import the XVA (ova.xml) into XenServer
  3. The VM should auto start after import (takes a while to import)
  4. View the console and set the root password.

Installation as ESX VM

yes, I know, blasphemer and all that...

Still looking for a good way to convert it to OVF...

My ugly ugly solution:

  1. deploy XVA to Citrix and power on
  2. create larger (10G+) ESX VMDK attached to running CentOS 5.9 VM
  3. dd/netcat to ESX VM's secondary hdd
    • xen vm:
      dd if=/dev/xvda1 | nc [OTHERSERVER] 8000
    • esx vm
      nc -l 8000 | dd of=/dev/sda
  4. fdisk, delete partition, recreate as full disk size, mark as bootable
  5. expand file system
    resize2fs /dev/sda1
  6. mount file system
    mount /dev/sda1 /mnt
  7. reinstall grub on secondary drive
    grub-install --root-directory=/mnt /dev/sda
  8. fix /etc/fstab and /boot/grub/grub.conf and change /dev/xvda1 to /dev/sda1
  9. chroot to the file system and rebuild initrd
    chroot /mnt
    /sbin/mkinitrd /boot/hack.img 3.10.0+0
  10. finally point grub to the new initrd /boot/hack.img
  11. boot and profit... phew...

Version

DDK Based off of RedHat EL5.

XenServer DDK 6.2.0-70446c
Linux xenserver-ddk 2.6.32.43-0.4.1.xs1.8.0.835.170778xen #1 SMP Wed May 29 18:06:30 EDT 2013 i686 i686 i386 GNU/Linux

Second HDD

Perform an online resize:

  1. With the DDK VM powered off, go to storage and edit the virtual disk
  2. Increase the size (Ex. 20G)
  3. Power on the VM
  4. fdisk /dev/xvda
    • p d 1 n p 1 [enter] [enter] w
  5. resize2fs /dev/xvda1
  6. profit!

-- alternative method --

The DDK VM has minimal space free. Let's add a second for development room.

Add second virtual disk for data:

fdisk /dev/xvdc
# partition: n p 1 [enter] [enter] w
mkfs.ext3 -L /data /dev/xvdc1
mkdir -p /data
echo "/dev/xvdc1      /data           ext3    defaults,noatime 0 0" >> /etc/fstab
mount /data
mkdir /data/src
ln -s /data/src /root/.src

Note: You will end up with this error in yum if you don't add a second data disk:

Insufficient space in download directory

Yum Configuration

Disable broken Citrix repo:

sed -i "s/enabled=1/enabled=0/" /etc/yum.repos.d/Citrix.repo

This fixes this error:

# yum list
...
Could not retrieve mirrorlist http://updates.vmd.citrix.com/XenServer/6.4.93/domain0/mirrorlist error was
[Errno 14] HTTP Error 404: Not Found
Error: Cannot find a valid baseurl for repo: citrix

Exclude kernel from updates: (already built into /etc/yum.repos.d/CentOS-Base.repo, with "exclude=kernel-xen*, *xen*")

#echo "exclude=kernel-xen*, *xen*" >> /etc/yum.conf
echo "exclude=kernel*" >> /etc/yum.conf

Install Tools

Install vim:

yum --enablerepo base  install vim-enhanced

HG Dependencies:

yum --enablerepo base  install zlib-devel bzip2-devel

Install Python

##
## PYTHON
##

mkdir -p ~/.src ; cd ~/.src
wget --no-check-certificate http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar -zvxf Python-2.7.6.tgz
cd Python-2.7.6
./configure --prefix=/opt/python-2.7.6 && make && make install && echo "SUCCESS"

export PATH=/opt/python-2.7.6/bin:$PATH
echo -e "\n\nexport PATH=/opt/python-2.7.6/bin:\$PATH\n" >> ~/.bash_profile

Install Mercurial

##
## MERCURIAL
##

MVER=3.0
mkdir -p ~/.src ; cd ~/.src
wget --no-check-certificate http://mercurial.selenic.com/release/mercurial-$MVER.tar.gz
tar -zvxf mercurial-$MVER.tar.gz
cd mercurial-$MVER
python setup.py install

Setup mercurial config

cat > ~/.hgrc << "EOF"
[ui]
username = My User
editor = vim
#ssh = ssh -l [USER]

[extensions]
color =
purge =
transplant =
rebase =
mq =
graphlog =
pager =

[pager]
pager = LESS='FRX' less
EOF

Install Scons

See scons

SVER=2.3.1
mkdir -p ~/.src ; cd ~/.src
#wget http://sourceforge.net/projects/scons/files/scons/$SVER/scons-$SVER.tar.gz/download
wget http://sourceforge.net/projects/scons/files/scons/$SVER/scons-$SVER.tar.gz/download -O scons-$SVER.tar.gz
tar -zvxf scons-$SVER.tar.gz
cd scons-$SVER
python setup.py install