Instructions for building the HIP OpenVZ test world

Jan 22, 2007

Jeff Ahrenholz

 

Linux preparation

  1. installed vmware server on a Linux machine
  2. installed FC5 from a mounted ISO
    1. deselected all of the package sets
    2. 1.8gb space is used initially
  3. install vmware-tools into guest OS
  4. perform `yum update` and reboot

 

OpenVZ preparation
Complete instructions found here: http://wiki.openvz.org/Quick_installation

  1. go to openvz.org and download the latest FC5 kernel source RPM
  2. add the OpenHIP patch to FC5 kernel source, which adds protocol 253 to the allowed protocols
    1. add openvz.socket.c.patch to /usr/src/redhat/SOURCES
    2. add patch to kernel-2.6.spec in /usr/src/redhat/SPECS
    3. yum install rpm-build redhat-rpm-config
    4. rpmbuild –ba --target=i686 kernel-2.6.spec from /usr/src/redhat/SPECS
    5. install kernel RPM:
      cd /usr/src/redhat/RPMS
      rpm –ivh --force kernel-2.6.16-1.2133_FC5.026test015.i686.rpm
      rpm –ivh --force kernel-devel-2.6.16-1.2133_FC5.026test015.i686.rpm
    6. check /etc/grub.conf, rename kernel to OpenVZ, and reboot
  3. add OpenVZ utilities
    1. rpm –ivh vzquota-3.0.9-1.i386.rpm
    2. rpm –ivh vzctl-libs-3.0.13-1.i386
    3. rpm –ivh vzctl-3.0.13-1.i386
  4. clean up to save disk space
    1. save generated RPMs for future use, or at least the src.rpm
    2. remove all RPMs from /usr/src/redhat/RPMS/i686, /usr/src/redhat/SRPMS
    3. rpmbuild --clean kernel-2.6.spec
    4. rpmbuild --rmsource kernel-2.6.spec
    5. should go from 4.4G used to 2.1G
  5. edit sysctl.conf per OpenVZ instructions
    found here: http://wiki.openvz.org/Quick_installation#sysctl
  6. reboot

Prepare the OS Template Cache

Complete instructions here: http://wiki.openvz.org/OS_template_cache_preparation

  1. download template meta data
  2. rpm –ivh vzrpm43-4.3.3-7_nonptl.6.i386.rpm vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm
  3. rpm –ivh vzyum-2.4.0-11.noarch.rpm
  4. rpm –ivh vzpkg-2.7.0-18.noarch.rpm
  5. download fedora-core-5-i386-default.tar.gz to /vz/template/cache

Create VEs

Complete instructions here: http://wiki.openvz.org/VE_creation

  1. vzctl create 101 --ostemplate fedora-core-5
    vzctl set 101 --hostname ve101 --ipadd 10.5.0.1 --save
    vzctl set 101 --onboot yes --save
    vzctl start 101
  2. vzctl create 102 --ostemplate fedora-core-5
    vzctl set 102 --hostname ve102 --ipadd 10.5.0.2 --save
    vzctl set 102 --onboot yes --save
    vzctl start 102
  3. configure networking between the two VEs
    1. modprobe vzethdev
    2. vzctl set 101 --veth_add veth101.0 ,00:A0:43:52:C9:01,eth0, 00:A0:43:52:C9:02 --save
    3. vzctl set 102 --veth_add veth102.0 ,00:A0:43:52:C9:03,eth0, 00:A0:43:52:C9:04 --save
    4. yum install bridge-utils
    5. brctl addbr vzbr0
    6. brctl addif veth101.0
    7. brctl addif veth102.0
    8. ifconfig vzbr0 up
    9. edit /etc/sysconfig/network-scripts/ifcfg-eth0 on VE 101 and 102 to configure the IP addresses 10.4.0.1 and 10.4.0.2

Fedora customizations

  1. edit .bashrc and put /sbin:/usr/sbin:/usr/local/sbin into path
  2. run vmware-config-tools.pl and answer questions
  3. run vmware-toolbox and click on time synchronization, shrink partitions
  4. add OpenHIP wallpaper to /usr/share/backgrounds
  5. edit /usr/share/gdm/themes/OpenHIP and choose the theme using gdmsetup
  6. create desktop icons for launching gnome-terminal into VE 101 and 102

OpenHIP preparations

  1. yum install libxml2-devel openssl-devel
  2. yum install autoconf autotools
  3. download hip source from anonymous CVS and run ./bootstrap.sh, ./configure
  4. run make
  5. cp src/hip /vz/root/101/usr/local/sbin
  6. cp src/hitgen /vz/root/101/usr/local/sbin
  7. cp src/hip /vz/root/102/usr/local/sbin
  8. cp src/hitgen /vz/root/102/usr/local/sbin
  9. run /usr/local/sbin/hitgen -conf, /usr/local/sbin/hitgen from VE 101 and 102
  10. set root password for virtual servers
  11. run /usr/local/sbin/hitgen -publish, edit with addresses, and scp known_host_identities.xml file to peer
  12. Fix firewall on host system to allow proto 253, ESP, and HIP UDP in /etc/sysconfig/iptables
  13. create a script for bringing up the network bridge in /etc/sysconfig/network-scripts/ifcfg-vzbr0 and /etc/rc.local
    1. brctl addbr vzbr0
    2. brctl addif vzbr0 veth101.0
    3. brctl addif vzbr0 veth102.0
    4. ifconfig vzbr0 up

Running HIP

  1. modprobe tun, add this to /etc/rc.local
  2. vzctl set 101 --devices c:10:200:rw --save
  3. vzctl set 102 --devices c:10:200:rw --save
  4. vzctl exec 101 mkdir -p /dev/net
  5. vzctl exec 101 mknod /dev/net/tun c 10 200
  6. vzctl exec 101 chmod 600 /dev/net/tun
  7. vzctl exec 102 mkdir -p /dev/net
  8. vzctl exec 102 mknod /dev/net/tun c 10 200
  9. vzctl exec 102 chmod 600 /dev/net/tun
  10. set preferred address to 10.4.0.x in hip.conf

Cleaning up

  1. rm -rf /vz/templates/cache/* (except for .tar.gz)
  2. remove non-essential RPMs, for example:
    rpm -e beagle evolution evolution-webcal evolution-sharp cleanup yelp seamonkey gnu-crypto jessie java-1.4.2-gcj-compat gnome-backgrounds tomboy
  3. rpm -e mono-data mono-web  mono-data-sqlite glx-utils foomatic system-config-printer hal-cups-utils desktop-printing system-config-printer-gui gimp-print-utils gimp-print ppp wvdial rp-pppoe
  4. rm -rf /var/tmp/kernel*
  5. stop virtual environments (removes /vz/root/*)
  6. shrink the virtual disk
    1. first fill the disk using dd if=/dev/zero of=/empty_file
    2. rm /empty_file
    3. stop machine, from Windows VMware Server, use the utility:
      vmware-vdiskmanager.exe -k HIP-FC5-OpenVZ.vmdk