ReferencePlatforms/Linux-CentOS-5.0

This procedure will re-create the CentOS 5.0-based reference VM image. The current version is Version 4. Internally, this VM is named CentOS-5.0-ref-tools-vm.

Things Done For You

Version 2

Install CentOS 5.0 from CDs

f749d7e17fa01604b9956304efba2333  CentOS-5.0-i386-bin-1of6.iso
963258ceafda5c5e6f79be86028b6b3d  CentOS-5.0-i386-bin-2of6.iso
a08ec9ccfdc89c24f3d6567219f90c42  CentOS-5.0-i386-bin-3of6.iso
b31c239009b780d1c89c311c192e43be  CentOS-5.0-i386-bin-4of6.iso
0c3990be2271bf44c1495aa0003b5552  CentOS-5.0-i386-bin-5of6.iso
9e6f91a5292f46b02777133765fc03fe  CentOS-5.0-i386-bin-6of6.iso

Package Selection

The Easy Way: the installer kickstart file (stored in internal repo).

The Hard Way:

While installing, select a the GNOME Desktop and then select Custom package development; the following categories were selected:

  • Desktop Environments
    • Gnome Desktop Environment
  • Applications
    • Editors
    • Test-based internet
      • Add lynx
  • Development
    • Development Tools
    • Development Libraries
    • X Software Development
    • GNOME Software Development
    • Legacy Software Development
  • Servers
    • Turn all off, except for "Printing Support
  • Base System
    • Turn off Dialup Networking
    • Turn on System Tools

Some Sys-prepping

We have some scripts that do some of this: root, cltbld

On first boot, CentOS will ask some questions:

  • Turn the firewall off (we run our build machines on their own network, behind a firewall)
  • Disable SELinux
  • Enable NTP
  1. Login; install VMwareTools-3.0.1-32039.rpm
  2. vmware-config-tools.pl
  3. add clock=pit and vdso=no lines to /boot/grub/grub.conf
  4. turn on syncTime in VMware config
  5. for s in auditd avahi-daemon acpid bluetooth cpuspeed hplip hidd mcstrans pcscd ntpd cups cups-config-daemon mdmonitor openibd smartd pcmcia isdn atd gpm anacron autofs apmd kudzu yum-updated; do chkconfig $s off; done
  6. chkconfig vncserver on
  7. Copy over cltbld's ssh keys from another tinderbox
  8. Edit /etc/mail/sendmail.cf and add mail.build.mozilla.org as the "Smart Relay"
  9. rm /etc/sshd/ssh_host_*

Add the following lines to ~/.bash_profile

export CVS_RSH=ssh
export JAVA_HOME=/builds/jdk
export TBOX_CLIENT_CVS_DIR="/builds/tinderbox/mozilla/tools"

Install Sun Java JDK

Note: we should archive this binary somewhere

d916c24bed9eef7aebc2626115e14a11  jdk-1_5_0_10-linux-i586.bin
  • Save to /tools
cd /tools
chmod 0755 ./dist/jdk-1_5_0_10-linux-i586.bin 
./dist/jdk-1_5_0_10-linux-i586.bin 
# type 'yes' to accept the license
ln -s jdk1.5.0_10/ jdk

Make GCC 4.1 (redhat branch)

md5sum gcc-4.1.1-30.src.rpm
# 555b8cb95d3d7d851b2ebd5c3cec7837  
rpm2cpio gcc-4.1.1-30.src.rpm | cpio -i gcc-4.1.1-20061011.tar.bz2
tar xfvj gcc-4.1.1-20061011.tar.bz2 
mkdir gcc-obj-release
cd gcc-obj-release/

../gcc-4.1.1-20061011/configure --enable-long-long --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++ --with-system-zlib --prefix=/tools/gcc-4.1.1 2>&1 | tee ../gcc-4.1.1-configure.log
make 2>&1 | tee ../gcc-4.1.1-make.log
make install 2>&1 | tee ../gcc-4.1.1-make_install.log

Build Python 2.5.1

(Some VMs use Python 2.5 or Python 2.4.4 but this is what is on the ref platform.)

wget http://python.org/ftp/python/2.5.1/Python-2.5.1.tar.bz2

tar xfvj dist/Python-2.5.1.tar.bz2 
cd Python-2.5.1/
./configure --prefix=/tools/python-2.5.1 2>&1 | tee /tools/dist/logs/python2.5.1-configure.log 
make 2>&1 | tee /tools/dist/logs/python2.5.1-make.log 
make install 2>&1 | tee /tools/dist/logs/python2.5.1-make_install.log
cd /tools/
ln -s python2.5.1 python

Version 3

Make directories

 mkdir -p /tools/dist/logs
 mkdir -p /builds/logs

Initial Setup Steps

export PYTHONHOME="/tools/python"
export PATH="/tools/python/bin:$PATH"

Installing Zope Interface

cd /tools/dist/
wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz
tar xfvz zope.interface-3.3.0.tar.gz 
cd zope.interface-3.3.0/
python setup.py install --prefix=/tools/zope-interface-3.3.0
cd /tools; ln -s zope-interface-3.3.0 zope-interface
export PYTHONPATH="/tools/zope-interface/lib/python2.5/site-packages:$PYTHONPATH"

Installing Twisted

cd /tools/dist/
wget http://tmrc.mit.edu/mirror/twisted/Twisted/2.4/TwistedCore-2.4.0.tar.bz2
wget http://tmrc.mit.edu/mirror/twisted/Twisted/2.4/Twisted-2.4.0.tar.bz2
tar xfvj TwistedCore-2.4.0.tar.bz2 
tar xfvj Twisted-2.4.0.tar.bz2 
cd TwistedCore-2.4.0
python setup.py install --prefix=/tools/twisted-core-2.4.0
pushd /tools/; ln -s twisted-core-2.4.0 twisted-core; popd
export PYTHONPATH="/tools/twisted-core/lib/python2.5/site-packages:$PYTHONPATH"
cd /tools/dist/Twisted-2.4.0/
python setup.py install --prefix=/tools/twisted-2.4.0
cd /tools; ln -s twisted-2.4.0 twisted
export PYTHONPATH="/tools/twisted/lib/python2.5/site-packages/:$PYTHONPATH"

Version 4

Installing Mercurial

wget http://www.selenic.com/mercurial/release/mercurial-0.9.5.tar.gz
tar -zvxf mercurial-0.9.5.tar.gz
cd mercurial-0.9.5
export PYTHONHOME="/tools/python"
export PATH="/tools/python/bin:$PATH"
python setup.py install

Installing Scratchbox

As root:

wget http://repository.maemo.org/stable/chinook/maemo-scratchbox-install_4.0.1.sh
chmod a+x ./maemo-scratchbox-install_4.0.1.sh
./maemo-scratchbox-install_4.0.1.sh -s /scratchbox
/scratchbox/sbin/sbox_adduser cltbld yes

As cltbld:
Comment out the PYTHONHOME and PATH entries in ~/.bash_profile.

source ~/.bash_profile
wget http://tablets-dev.nokia.com/chinook/maemo-sdk-install_4.0.1.sh
chmod +x maemo-sdk-install_4.0.1.sh
bash maemo-sdk-install_4.0.1.sh
/scratchbox/login
wget http://ftp.gnome.org/pub/gnome/sources/libIDL/0.8/libIDL-0.8.9.tar.gz
tar -xzvf libIDL-0.8.9.tar.gz
cd libIDL-0.8.9
./configure --prefix=/usr
make
make install

Remove the comments from the PYTHONHOME and PATH entries in ~/.bash_profile and source it again.

Installing Nagios NRPE Daemon

wget http://dag.wieers.com/rpm/packages/nagios-plugins/nagios-plugins-1.4.9-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/nagios-nrpe/nagios-nrpe-2.5.2-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/nagios-nrpe/nagios-plugins-nrpe-2.5.2-1.el5.rf.i386.rpm
rpm --nodeps -i *.rpm
chkconfig --level 235 nrpe on
# todo: make sure this is right after configs get checked in
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -d nagios mozilla/tools/nagios
mv nagios/nrpe-linux.cfg /etc/nagios/nrpe.cfg

Post-Install Setup

Post-install instructions are written for the latest version (currently, Version 4).
You should have a /builds drive added to the VM before completing this section. All of this should be run as root.

Fixup Scratchbox Install

On Centos5, need to make the following changes to sysctl.conf

 $ su 
 # vi /etc/sysctl.conf
...and append
vm.vdso_enabled = 0
vm.mmap_min_addr = 4096 
 # 
 # /sbin/sysctl -p
...
vm.vdso_enabled = 0 
vm.mmap_min_addr = 4096
 # exit

...there is no need to reboot.


su -
cd ~ 
wget http://scratchbox.org/download/files/sbox-releases/stable/tarball/scratchbox-toolchain-cs2007q3-glibc2.5-arm6-1.0.7-3-i386.tar.gz
wget http://scratchbox.org/download/files/sbox-releases/stable/tarball/scratchbox-devkit-cputransp-1.0.7-i386.tar.gz
cd /
tar zxvf ~/scratchbox-toolchain-cs2007q3-glibc2.5-arm6-1.0.7-3-i386.tar.gz
tar zxvf ~/scratchbox-devkit-cputransp-1.0.7-i386.tar.gz
cd /scratchbox
wget https://bugzilla.mozilla.org/attachment.cgi?id=334232 
chmod a+x moz_scratchbox

cd /scratchbox/etc
mv resolv.conf resolv.conf.orig
cp /etc/resolv.conf .

# exit from running as root, now back to cltbld account.
/scratchbox/moz_scratchbox

sb-conf setup CHINOOK-ARMEL-2007 -c cs2007q3-glibc2.5-arm6 -d cputransp:debian-etch:doctools:maemo3-tools:perl -t /scratchbox/devkits/cputransp/bin/qemu-arm-cvs-m
sb-conf rootstrap CHINOOK-ARMEL-2007 http://repository.maemo.org/stable/4.0.1/armel/maemo-sdk-rootstrap_4.0.1_armel.tgz
sb-conf install CHINOOK-ARMEL-2007 -cedFGS
sb-conf select CHINOOK-ARMEL-2007

exit

wget http://repository.maemo.org/stable/chinook/maemo-sdk-nokia-binaries_4.0.1.sh
chmod +x maemo-sdk-nokia-binaries_4.0.1.sh
## following line failed out with permission errors
## sh ./maemo-sdk-nokia-binaries_4.0.1.sh 
## so did the following instead:
$ su -
# cd /scratchbox
# sh /home/cltbld/maemo-sdk-nokia-binaries_4.0.1.sh

Note: you'll have to space/more to the end of the EULA, and then enter 'I accept'



/scratchbox/login

wget http://people.mozilla.com/~vladimir/misc/execstack.armel
chmod a+x execstack.armel
fakeroot mv execstack.armel /usr/bin/execstack
execstack -c `find /lib/ -name \*.so.\* -type f`
execstack -c `find /usr/lib/ -name \*.so.\* -type f`
fakeroot echo "deb http://repository.maemo.org/extras-devel chinook free non-free" >> /etc/apt/sources.list
fakeroot echo "deb file:/home/$USER/maemo-sdk-nokia-binaries_4.0.1 chinook explicit" >> /etc/apt/sources.list
fakeroot apt-get update
fakeroot apt-get install libgtk2.0-dev libxaw7-dev libfreetype6-dev libxi-dev libhildonmime-dev libosso-dev libidl-dev liblocation-dev libasound2-dev

exit

Also, need to do https://wiki.mozilla.org/ReferencePlatforms/Linux-CentOS-5.0#Move_Scratchbox to avoid filling root partition.

Installing BuildBot

Because our Buildbot code changes fairly regularly we don't keep a copy of it on the VM.

export PYTHONPATH=".:/tools/zope-interface/lib/python2.5/site-packages/:/tools/twisted-core/lib/python2.5/site-packages:/tools/twisted/lib/python2.5/site-packages/:$PYTHONPATH"
export PYTHONHOME="/tools/python"
export PATH="/tools/python/bin:/tools/twisted/bin:/tools/twisted-core/bin:$PATH"
cd /tools
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -d buildbot-077 mozilla/tools/buildbot
cd /tools/buildbot-077
python setup.py install --prefix=/tools/buildbot-077
cd /tools; ln -s buildbot-077 buildbot
# buildbotcustom is only required if you're running a Buildbot master
mkdir buildbotcustom
cd buildbotcustom
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -d buildbotcustom mozilla/tools/buildbotcustom

Path Setup

Add the appropriate paths to the cltbld user's .bash_profile

export PYTHONHOME="/tools/python"
export PYTHONPATH="/tools/buildbotcustom:/tools/buildbot/lib/python2.5/site-packages:/tools/twisted/lib/python2.5/site-packages:/tools/twisted-core/lib/python2.5/site-packages:/tools/zope-interface/lib/python2.5/site-packages/"
export PATH="/opt/local/bin:/tools/buildbot/bin:/tools/twisted/bin:/tools/twisted-core/bin:$PYTHONHOME/bin:$PATH"

Compiler Setup

Symlink gcc-4.1.1 to gcc in /tools:

cd /tools
ln -s gcc-4.1.1 gcc

To build mozilla

The mozconfig for building mozilla should contain the following settings:

CC=/tools/gcc/bin/gcc
CXX=/tools/gcc/bin/g++