Wednesday, March 23, 2011

Install Luster Monitoring Tool (LMT) on CentOS 5.5

In this article, I document the steps to build and install LMT and it's dependency Cerebro. The configuration of Cerebro can get pretty complex, in this example we make it simple to focus on LMT.

I don't cover MySQL configuration yet but plan to do so in the near future.

Cerebro and LMT Build Instructions

The build and install OS are CentOS 5.5 x86_64 systems.
  1. Download and build cerebro (http://sourceforge.net/projects/cerebro/files/cerebro/) on your favorite build machine (make sure to set up your ~/rpmbuild directory structure and your ~/.rpmmacros file).
    • Download the latest source code (1.12 at this time) to ~/rpmbuild/SOURCES/
    • Download the src.rpm (I found it under the version 1.10 tree) and extract
      
      $ mkdir ~/sources/cerebro
      $ cd ~/sources/cerebro
      $ rpm2cpio cerebro-1.10-1.src.rpm | cpio -idvm
      $ mv cerebro.spec ~/rpmbuild/SPECS/
      
      
    • Modify the cerebro.spec file as follows for version 1.12 (unified diff format)
      
      --- cerebro.spec 2010-04-07 16:17:35.000000000 -0500
      +++ cerebro.spec.new 2011-03-23 14:25:02.654373643 -0500
      @@ -1,12 +1,12 @@
       Name:    cerebro 
      -Version: 1.10
      +Version: 1.12
       Release: 1
       
       Summary: Cerebro cluster monitoring tools and libraries
       Group: System Environment/Base
       License: GPL
      -Source: cerebro-1.10.tar.gz
      -BuildRoot: %{_tmppath}/cerebro-1.10
      +Source: cerebro-1.12.tar.gz
      +BuildRoot: %{_tmppath}/cerebro-1.12
       
       %description
       Cerebro is a collection of cluster monitoring tools and libraries.
      @@ -90,7 +90,7 @@
       Event module to monitor node up/down.
       
       %prep
      -%setup  -q -n cerebro-1.10
      +%setup  -q -n cerebro-1.12
       
       %build
       %configure --program-prefix=%{?_program_prefix:%{_program_prefix}} \
      @@ -157,6 +157,7 @@
       %defattr(-,root,root)
       %doc README NEWS ChangeLog DISCLAIMER DISCLAIMER.UC COPYING
       %config(noreplace) %{_sysconfdir}/init.d/cerebrod
      +%config(noreplace) %{_sysconfdir}/cerebro.conf
       %{_includedir}/*
       %dir %{_libdir}/cerebro
       %{_libdir}/libcerebro*
      
    • Before building the rpm I had to comment out the %_vendor string in my .rpmmacros file, otherwise the configure kept adding the vendor to the --target switch
    • Build the rpm, this will build several rpms, for Lustre Monitoring Tool all we need is the cerebro package
      
      $ rpmbuild -ba --sign ~/rpmbuild/SPECS/cerebro.spec
      
      
    • Look at the package info
      
      $ rpm -qpi ~/rpmbuild/RPMS/x86_64/cerebro-1.12-1.x86_64.rpm 
      Name        : cerebro                      Relocations: (not relocatable)
      Version     : 1.12                              Vendor: (none)
      Release     : 1                             Build Date: Wed 23 Mar 2011 02:12:09 PM CDT
      Install Date: (not installed)               Build Host: buildhost01
      Group       : System Environment/Base       Source RPM: cerebro-1.12-1.src.rpm
      Size        : 1039859                          License: GPL
      Signature   : DSA/SHA1, Wed 23 Mar 2011 02:12:09 PM CDT, Key ID xxxx
      Summary     : Cerebro cluster monitoring tools and libraries
      Description :
      Cerebro is a collection of cluster monitoring tools and libraries.
      
      
    • Take a look at the contents of the rpm
      
      $ rpm -qpl ~/rpmbuild/RPMS/x86_64/cerebro-1.12-1.x86_64.rpm 
      /etc/cerebro.conf
      /etc/init.d/cerebrod
      /usr/include/cerebro
      /usr/include/cerebro.h
      ...
      
  2. LMT RPM build
    • Temporarily install cerebro to satisfy the build requirement
      
      $ sudo rpm -Uvh ~/rpmbuild/RPMS/x86_64/cerebro-1.12-1.x86_64.rp
      
      
    • Install lua-devel package from Epel
      
      $ sudo yum install lua-devel
      
      =============================================================================================
       Package                Arch                Version                  Repository         Size
      =============================================================================================
      Installing:
       lua-devel              i386                5.1.4-4.el5              epel               18 k
       lua-devel              x86_64              5.1.4-4.el5              epel               18 k
      Installing for dependencies:
       lua                    i386                5.1.4-4.el5              epel              228 k
       lua                    x86_64              5.1.4-4.el5              epel              229 k
      
      
    • Download the lmt src rpm
      
      $ mkdir ~/sources/lmt
      $ cd ~/sources/lmt
      $ wget http://lmt.googlecode.com/files/lmt-3.1.2-1.src.rpm
      
      $ rpmbuild --rebuild --sign lmt-3.1.2-1.src.rpm
      
      
      $ ls -l ~/rpmbuild/RPMS/x86_64/lmt-*
      lmt-3.1.2-1.el5.myrepo.x86_64.rpm
      lmt-server-3.1.2-1.el5.myrepo.x86_64.rpm
      lmt-server-agent-3.1.2-1.el5.myrepo.x86_64.rpm
      
      
    • LMT-GUI RPM build
    • Install the prerequisite java-devel
      
      $ sudo yum install java-devel
      
      =======================================================================================================
       Package                        Arch         Version                       Repository             Size
      =======================================================================================================
      Installing:
       java-1.6.0-openjdk-devel       x86_64       1:1.6.0.0-1.16.b17.el5        centos5-updates        12 M
      
      Transaction Summary
      =======================================================================================================
      
    • Download the lmt-gui src rpm and build
      
      $ mkdir ~/sources/lmt-gui
      $ cd ~/sources/lmt-gui
      $ wget http://lmt.googlecode.com/files/lmt-gui-3.0.0-1.src.rpm
      
      $ rpmbuild --rebuild --sign lmt-gui-3.0.0-1.src.rpm 
      
      
      
      $ rpm -qpi ~/rpmbuild/RPMS/x86_64/lmt-gui-3.0.0-1.el5.myrepo.x86_64.rpm 
      Name        : lmt-gui                      Relocations: (not relocatable)
      Version     : 3.0.0                             Vendor: (none)
      Release     : 1.el5.myrepo                 Build Date: Wed 23 Mar 2011 02:44:25 PM CDT
      Install Date: (not installed)               Build Host: build01
      Group       : Applications/System           Source RPM: lmt-gui-3.0.0-1.el5.myrepo.src.rpm
      Size        : 2347300                          License: GPL
      Signature   : DSA/SHA1, Wed 23 Mar 2011 02:44:25 PM CDT, Key ID xxxx
      Packager    : Jim Garlick 
      URL         : http://code.google.com/p/lmt
      Summary     : Lustre Montitoring Tools Client
      Description :
      Lustre Monitoring Tools (LMT) GUI Client
      
      
    • Next I copy the RPMs to our local repository
      
      $ cd ~/rpmbuild/RPMS/x86_64/
      $ cp -a lmt-* cerebro-1.12-1.x86_64.rpm /share/repo/mirror/myrepo/el5/x86_64/RPMS/
      
      $ cd ../../SRPMS
      $ cp -a cerebro-* /share/repo/mirror/myrepo/el5/SRPMS/
      $ cd ~/sources
      $ cp -a lmt/lmt-3.1.2-1.src.rpm lmt-gui/lmt-gui-3.0.0-1.src.rpm /share/repo/mirror/myrepo/el5/SRPMS/
      
    • Rebuild the repodata for the repository
      
      $ createrepo /share/repo/mirror/myrepo/el5/x86_64/
      

Cerebro and LMT Install Instructions

  1. Install cerebro and lmt-server-agent on the mds's and oss's
    
    $ for n in mds-{0..1} oss-{0..2}; do ssh root@lustre-$n yum install -y cerebro lmt-server-agent ; done
    
  2. Install cerebro and lmt-server on the management server
    
    $ ssh root@management-server yum -y install cerebro lmt-server
    
  3. Modify the /etc/cerebro.conf file to look like this (by default the entire file is comments, append this to the end)
    • On the Lustre servers
      
      cerebro_metric_server 192.168.0.10
      cerebro_event_server 192.168.0.10
      cerebrod_heartbeat_frequency 10 20
      cerebrod_speak on
      cerebrod_speak_message_config 192.168.0.10
      cerebrod_listen off
      
    • On the management server
      
      cerebrod_heartbeat_frequency 10 20
      cerebrod_speak on
      cerebrod_speak_message_config 192.168.0.10
      cerebrod_listen on
      cerebrod_listen_message_config 192.168.0.10
      cerebrod_metric_controller on
      cerebro_metric_server 192.168.0.10
      cerebrod_event_server on
      cerebro_event_server 192.168.0.10
      
  4. Configure the daemon to start on the servers and management server
    
    $ for n in mds-{0..1} oss-{0..2}; do ssh root@lustre-$n "/sbin/chkconfig cerebrod on && /sbin/service cerebrod start" ; done
    
    $ ssh root@managment-server "/sbin/chkconfig cerebrod on && /sbin/service cerebrod start"
    
    
  5. Login to the management server and verify that the server see's all of the servers (this can be run from any of the servers, not just the management server)
    
    $ /usr/sbin/cerebro-stat -m updown_state
    
    MODULE DIR = /usr/lib64/cerebro
    mgmt-srv: 1
    lustre-mds-0: 1
    lustre-mds-1: 1
    lustre-oss-0: 1
    lustre-oss-1: 1
    lustre-oss-2: 1
    
  6. Now run the -l switch to see the available metrics (lmt_mdt, lmt_ost and lmt_osc are added by the lmt-server package)
    
    $ /usr/sbin/cerebro-stat -l
    
    MODULE DIR = /usr/lib64/cerebro
    metric_names
    cluster_nodes
    lmt_mdt
    updown_state
    lmt_ost
    lmt_osc
    
  7. Run the ltop (will default to the first Lustre file system found unless otherwise specified) command on the management node to view a toplike output for OSTs
    
    $ ltop
    
    Filesystem: lustre
        Inodes:    209.344m total,     77.286m used ( 37%),    132.057m free
         Space:     42.978t total,     15.931t used ( 37%),     27.047t free
       Bytes/s:  0.000g read,       0.000g write,                 1 IOPS
       MDops/s:  4 open,        2 close,     285 getattr, 0 setattr
                     0 link,        0 unlink,      0 mkdir,         0 rmdir
                     1 statfs, 5 rename,      0 getxattr
    >OST S        OSS   Exp   CR rMB/s wMB/s  IOPS   LOCKS  LGR  LCR %cpu %mem %spc
    0000 F stre-oss-0   131    0     0     0     0  515290   87    0    0  100   41
    0001 F stre-oss-0   131    0     0     0     0  528633  106    0    0  100   41
    0002 F stre-oss-1   131    0     0     0     0  509573   16    0    0  100   35
    0003 F stre-oss-1   131    0     0     0     0  518495   21    0    0  100   36
    0004 F stre-oss-2   131    0     0     0     0  533299   49    0    0  100   34
    0005 F stre-oss-2   131    0     0     0     0  527621   61    0    0  100   35
    

Friday, March 18, 2011

Using check_openmanage with check_mk

Here's my guide to installing check_openmanage in an OMD site, in case it helps anyone:

This was done on the following system:
Unless otherwise specified all paths are relative to the site owners home (ex: /opt/omd/sites/mysite)
  1. Make sure your dell servers had the following SNMP packages installed prior to installing OMSA (if not, it's easy to 'yum remove srvadmin-\*' 'yum install srvadmin-all': net-snmp, net-snmp-libs, net-snmp-utils
    • Start the OMSA services 'srvadmin-services.sh start' and then check 'srvadmin-services.sh status' to verify that the snmpd component is running
    • Ensure that snmpd is running and configured
    • Configure the firewall to allow access from your OMD server to udp port 161
  2. change users on your OMD server to the site user: $ su - mysite
  3. Download the latest check_openmanage from http://folk.uio.no/trondham/software/check_openmanage.html to ~/tmp and extract
  4. copy the check_openmanage script to local/lib/nagios/plugins (this defaults to $USER2$ in your commands)
    
    $ cp tmp/check_openmanage-3.6.5/check_openmanage local/lib/nagios/plugins/
    $ chmod +x local/lib/nagios/plugins/check_openmanage
    
  5. copy the PNP4Nagios template
    
    $ cp tmp/check_openmanage-3.6.5/check_openmanage.php etc/pnp4nagios/templates/
    
  6. If you are running CentOS 5.5/RHEL 5.5 or earlier (it's unclear whether or not this will be an issue in EL5.6), and you want performance graphs, you'll need to edit the check_openmanage.php template (see this bug: https://bugs.op5.com/bug_view_advanced_page.php?bug_id=4008), comment out the original condition and replace:
    
    $ vi etc/pnp4nagios/templates/check_openmanage.php
    
    ##    if(preg_match('/^enclosure_(?.+?)_temp_\d+$/', $NAME[$i], $matches)
    ##       || preg_match('/^e(?.+?)t\d+$/', $NAME[$i], $matches)){
    # This is the fixed line for CentOS 5.5 and prior
         if(preg_match('/^enclosure_(.+?)_temp_\d+$/', $NAME[$i], $matches)){
    
  7. Test check_openmanage to see that it can successfully query a node (ack, I need to update my driver)
    
    local/lib/nagios/plugins/check_openmanage -H dell-r710-01 -p -C MySecretCommunity
    
    Controller 1 [SAS 5/E Adapter]: Driver '3.04.13rh' is out of date|fan_0_system_board_fan_1_rpm=3600;0;0 fan_1_system_board_fan_3_rpm=3600;0;0 fan_2_system_board_fan_4_rpm=3600;0;0 fan_3_system_board_fan_5_rpm=3600;0;0 fan_4_system_board_fan_2_rpm=3600;0;0 pwr_mon_0_ps_1_current=0.6;0;0 pwr_mon_1_ps_2_current=0.4;0;0 pwr_mon_2_system_board_system_level=182;0;0 temp_0_system_board_ambient=21;42;47
    
    
  8. Edit the main.mk file to add tags to the OMSA hosts and the check command (the perfdata_format and monitoring_host I got from a previous emailer to the list, not sure if they are needed)
    
    all_hosts = [ 'dell-r710-01|linsrv|kvm|omsa|nonpub', 'dell-2950-01|linsrv|omsa|nonpub', 'hp-srv-01|winsrv|smb', ]
    
    # Are you using PNP4Nagios and MRPE checks? This will make PNP
    # choose the correct template for standard Nagios checks:
    perfdata_format = "pnp"
    #set the monitoring host
    monitoring_host = "nagios"
    
    # SNMP Community
    snmp_default_community = "someCommunityRO"
    
    snmp_communities = [
      ( "MySecretCommunity", ["nonpub"], ALL_HOSTS ),
    ]
    
    # other main.mk stuff
    
    extra_nagios_conf += r"""
    
    # ARG1: community string
    define command {
        command_name    check_openmanage
        command_line    $USER2$/check_openmanage -H $HOSTADDRESS$ -p -C $ARG1$
    }
    
    """
    
    legacy_checks = [
      # On all hosts with the tag 'omsa' check Dell OpenManage for status 
      # service description "Dell OMSA", process performance data
      ( ( "check_openmanage!MySecretCommunity", "Dell OMSA", True), [ "omsa" ], ALL_HOSTS ),
    ]
    
  9. That should be it, simply reload and your new check should start working for all hosts tagged with 'omsa'
    
    $ check_mk -O
    
    
To make it cleaner, the legacy_check should be able to determine the community string based on the settings in snmp_default_community and snmp_communities

I've only been testing check_mk for a few days now and am not sure how to do that. (suggestions?)

Hope this helps, and comments are welcome.

Monday, February 21, 2011

Building Mellanox OFED 1.5.2 for Rocks 5.4

Here are my notes from Rocks 5.4 and Mellanox OFED 1.5.2

Perform the build steps on a compute node. That way if the build process, run as root, has a bug, we don't risk having to rebuild the head node.

The MLNX_OFED-1.5.2 comes with modules for kernel 2.6.18-194.el5, we are using 2.6.18-194.17.1.el5, so we need to build new kernel modules.

1. Download the ISO file MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso from this page

2. Ensure that the build system is running the correct kernel

# uname -r

2.6.18-194.17.1.el5

3. Mount the ISO and copy the contents to a scratch work area

# mount -t iso9660 -o loop /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso /mnt/cdrom 
# mkdir /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5
# cp -r /mnt/cdrom/* /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5/
# umount /mnt/cdrom
# rm /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso

4. Install some dependencies

# yum -y install libtool tcl-devel libstdc++-devel mkisofs gcc-c++ rpm-build

5. Uninstall some RPM files that will fail to uninstall during the ISO build

# yum remove \*openmpi\*

6. Build the new ISO file

# cd /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5

# ./docs/mlnx_add_kernel_support.sh -i /root/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso
Note: This program will create MLNX_OFED_LINUX ISO for rhel5.5 under /tmp directory.
      All Mellanox, OEM, OFED, or Distribution IB packages will be removed.
Do you want to continue?[y/N]:y
Building OFED RPMs...
Removing OFED RPMs...
Running mkisofs...
Created /tmp/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso

# mkdir /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5
# mv /tmp/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5.iso /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5.iso

7. Copy the new files from the iso to the NFS share

# mount -t iso9660 -o loop /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5.iso /mnt/cdrom
# rsync -a /mnt/cdrom/ /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5/

# umount /mnt/cdrom

8. List the new kernel modules

# cd /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5
# find . -name kernel-* | grep 194.17
./x86_64/kernel-ib-1.5.2-2.6.18_194.17.1.el5.x86_64.rpm
./x86_64/kernel-mft-2.6.2-2.6.18_194.17.1.el5.x86_64.rpm
./x86_64/kernel-ib-devel-1.5.2-2.6.18_194.17.1.el5.x86_64.rpm

9. Test the installer on one of the compute nodes

# cd /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5
# ./mlnxofedinstall --force --hpc

This will automatically update the firmware on the HCA.

10. This OFED can be installed on the compute nodes by adding this section to extend-compute.xml (note, I normally put other driver updates into this 'post-98-installdrivers' script). Also notice the yum install, the MLNX OFED install will remove any package containing 'openmpi' in the package name, this line reinstalls said packages


<file name="/etc/rc.d/rocksconfig.d/post-98-installdrivers" perms="0755">
#!/bin/sh

# Install Mellanox
if [ "$(/sbin/lspci | grep -i connectx)" != "" ] ; then
  /usr/bin/yum -y remove openmpi\* rocks-openmpi\*
  /share/apps/mellanox/MLNX_OFED_LINUX-1.5.2-2.0.0-rhel5.5-2.6.18-194.17.1.el5/mlnxofedinstall --hpc --force

  /sbin/chkconfig --add openibd
  /sbin/chkconfig openibd on
  /sbin/service openibd start
fi

/usr/bin/yum -y install my-custom-openmpi my-custom-application-openmpi

/bin/mv /etc/rc.d/rocksconfig.d/post-98-installdrivers /root/post-98-installdrivers

# Reboot one final time
/sbin/shutdown -r now

</file>

Adding Infiniband over IP to Rocks

20120611 - Based on a question to the Rocks mailing list, I'm adding this section to explain how to enable TCP/IP over Inifiniband via Rocks. This process should add the IP addresses to the Rocks managed DNS / hosts. The IP addresses of my compute-0-x nodes start at 254 and work backwards, so that's what I used for the IB ip addresses: First add the new network, calling it 'infiniband', or whatever name you'd like
# rocks add network infiniband subnet=192.168.3.0 netmask=255.255.255.0
# ip=254 && for node in {1..16}; do
   rocks add host interface compute-0-${node} ib0 \
     ip=192.168.3.${ip} subnet=ib-cheaha ;
   let ip=${ip}-1 ;
done
Repeat for the next set of nodes
# ip=238 && for node in {1..16}; do
   rocks add host interface compute-1-${node} ib0 \
     ip=192.168.3.${ip} subnet=ib-cheaha ;
   let ip=${ip}-1 ;
done
And so on... Change the sshd_config on the compute nodes to not use DNS. I have found that ssh to compute nodes take close to a minute when this is set to true
# rocks set attr ssh_use_dns false
Synchronize the configuration

# rocks sync config
Now open the firewall the ib0 for all ports and protocols
# rocks open appliance firewall compute \
   network=infiniband service="all" protocol="all"

# rocks sync host firewall compute

# rocks list host firewall compute-0-1
SERVICE PROTOCOL CHAIN ACTION NETWORK   OUTPUT-NETWORK FLAGS                                COMMENT SOURCE
ssh     tcp      INPUT ACCEPT public     -------------- -m state --state NEW                 ------- G     
all     all      INPUT ACCEPT public     -------------- -m state --state RELATED,ESTABLISHED ------- G     
all     all      INPUT ACCEPT infiniband -------------- ------------------------------------ ------- A     
all     all      INPUT ACCEPT private    -------------- ------------------------------------ ------- G     
Hope this helps

Building Mellanox OFED 1.4 for Rocks 5.3

Here are my notes from building Mellanox OFED 1.4 on a Rocks 5.3 x86_64 cluster utilizing CentOS 5.4 and kernel 2.6.18-128-7.1:

1. Download the ISO file MLNX_OFED_LINUX-1.4-rhel5.3.iso from this page

The MLNX_OFED-1.4 comes with modules for kernel 2.6.18-128, we are using 2.6.18-128-7.1, so we need to build new modules.

2. Mount the ISO and copy the contents to a scratch work area

# mount -t iso9660 -o loop /root/MLNX_OFED_LINUX-1.4-rhel5.3.iso /mnt/cdrom 
# mkdir /root/MLNX_OFED-1.4
# cp -r /mnt/cdrom/* /root/MLNX_OFED_LINUX-1.4/
# umount /mnt/cdrom

3. Edit the script so that it will work with CentOS (our centos-release says 5.4, we are still running a 5.3 kernel), this is the script that will build a new ISO file

# cd /root/MLNX_OFED-1.4

TabularUnifieddocs/mlnx_add_kernel_support.sh
Index: docs/mlnx_add_kernel_support.sh
===================================================================
--- docs/mlnx_add_kernel_support.sh.orig 2009-12-17 15:51:46.000000000 -0600
+++ docs/mlnx_add_kernel_support.sh 2009-12-17 15:52:00.000000000 -0600
@@ -279,7 +279,7 @@
         redhat-release-5Server-5.2.0.4)
         distro="rhel5.2"
         ;;
-        redhat-release-5Server-5.3.0.3)
+        redhat-release-5Server-5.3.0.3 | centos-release-5-4.el5.centos.1 )
         distro="rhel5.3"
         ;;
         sles-release-10-15.2)
4. Install some dependencies

# yum -y install libtool tcl-devel libstdc++-devel mkisofs gcc-c++

5. Uninstall some RPM files that will fail to uninstall during the ISO build

/bin/rpm --nodeps -e --allmatches openmpi-libs-1.3.2-2.el5 \
 openmpi-devel-1.3.2-2.el5 rocks-openmpi-1.3.2-1 openmpi-libs-1.3.2-2.el5 \
 openmpi-devel-1.3.2-2.el5 openmpi-1.3.2-2.el5 openmpi-1.3.2-2.el5 \
 openmpi-gnu-1.3.3-1.el5.uabeng

6. Build the new ISO file

# cd /root/MLNX_OFED_LINUX-1.4
# ./docs/mlnx_add_kernel_support.sh -i /root/MLNX_OFED_LINUX-1.4-rhel5.3.iso

Note: This program will create MLNX_OFED_LINUX ISO for rhel5.3 under /tmp directory.
      All Mellanox, OEM, OFED, or Distribution IB packages will be removed.
Do you want to continue?[y/N]:y
Building OFED RPMs...
Removing OFED RPMs...
Running mkisofs...
Created /tmp/MLNX_OFED_LINUX-1.4-rhel5.3.iso

# mv /tmp/MLNX_OFED_LINUX-1.4-rhel5.3.iso /share/apps/mellanox/MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1.iso

7. Copy the new files from the iso to the NFS share

# mount -t iso9660 -o loop /share/apps/mellanox/MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1.iso /mnt/cdrom
# cp -r /mnt/cdrom /share/apps/mellanox/MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1

# cd /share/apps/mellanox
# find ./MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1 -name kernel-* | grep x86
./MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1/x86_64/kernel-ib-1.4-2.6.18_128.7.1.el5.x86_64.rpm
./MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1/x86_64/kernel-ib-1.4-2.6.18_128.el5.x86_64.rpm
./MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1/x86_64/kernel-ib-devel-1.4-2.6.18_128.el5.x86_64.rpm
./MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1/x86_64/kernel-ib-devel-1.4-2.6.18_128.7.1.el5.x86_64.rpm

8. Test the installer on the compute node

# cd /share/apps/mellanox/MLNX_OFED_LINUX-1.4-rhel5.3-kernel-2.6.18_128.7.1
# ./mlnxofedinstall --hpc

This program will install the MLNX_OFED_LINUX package on your machine.
Note that all other Mellanox, OEM, OFED, or Distribution IB packages will be removed. 
Do you want to continue?[y/N]:y

Uninstalling the previous version of OFED 

Starting MLNX_OFED_LINUX-1.4 installation ... 

Installing mpi-selector RPM 
Preparing...                ########################################### [100%]
   1:mpi-selector           ########################################### [100%]
Installing kernel-ib RPM 
Preparing...                ########################################### [100%]
   1:kernel-ib              ########################################### [100%]
Installing ib-bonding RPM 
Preparing...                ########################################### [100%]
   1:ib-bonding             ########################################### [100%]
Installing mft RPM 
Preparing...                ########################################### [100%]
   1:mft                    ########################################### [100%]
Install user level RPMs: 
Preparing...                ########################################### [100%]
   1:libibverbs             ########################################### [  2%]
   2:libibcommon            ########################################### [  4%]
   3:libibumad              ########################################### [  6%]
   4:opensm-libs            ########################################### [  8%]
   5:librdmacm              ########################################### [ 10%]
   6:openmpi_intel          ########################################### [ 12%]
   7:libibmad               ########################################### [ 14%]
   8:infiniband-diags       ########################################### [ 16%]
   9:openmpi_gcc            ########################################### [ 18%]
  10:mpitests_openmpi_gcc   ########################################### [ 20%]
  11:mpitests_openmpi_pgi   ########################################### [ 22%]
  12:mpitests_openmpi_intel ########################################### [ 24%]
  13:qperf                  ########################################### [ 26%]
  14:perftest               ########################################### [ 28%]
  15:ibutils                ########################################### [ 30%]
  16:libmthca               ########################################### [ 32%]
  17:libmlx4                ########################################### [ 34%]
  18:openmpi_pgi            ########################################### [ 36%]
  19:mstflint               ########################################### [ 38%]
  20:mlnxofed-docs          ########################################### [ 40%]
  21:ofed-scripts           ########################################### [ 42%]
  22:libibverbs             ########################################### [ 44%]
  23:libibcommon            ########################################### [ 46%]
  24:libibumad              ########################################### [ 48%]
  25:mvapich_intel          ########################################### [ 50%]
  26:opensm-libs            ########################################### [ 52%]
  27:librdmacm              ########################################### [ 54%]
  28:libibcommon-devel      ########################################### [ 56%]
  29:libibumad-devel        ########################################### [ 58%]
  30:libibverbs-devel       ########################################### [ 60%]
  31:librdmacm-utils        ########################################### [ 62%]
  32:opensm                 ########################################### [ 64%]
  33:mvapich_gcc            ########################################### [ 66%]
  34:mpitests_mvapich_gcc   ########################################### [ 68%]
  35:mpitests_mvapich_pgi   ########################################### [ 70%]
  36:mpitests_mvapich_intel ########################################### [ 72%]
  37:mvapich_pgi            ########################################### [ 74%]
  38:libibverbs-utils       ########################################### [ 76%]
  39:librdmacm-devel        ########################################### [ 78%]
  40:librdmacm-devel        ########################################### [ 80%]
  41:opensm-devel           ########################################### [ 82%]
  42:opensm-devel           ########################################### [ 84%]
  43:libibumad-devel        ########################################### [ 86%]
  44:libibcommon-devel      ########################################### [ 88%]
  45:libibverbs-devel       ########################################### [ 90%]
  46:libibmad               ########################################### [ 92%]
  47:libmthca               ########################################### [ 94%]
  48:libmlx4                ########################################### [ 96%]
  49:libibmad-devel         ########################################### [ 98%]
  50:libibmad-devel         ########################################### [100%]
Device (15b3:673c):
        0c:00.0 InfiniBand: Mellanox Technologies MT26428 [ConnectX VPI PCIe 2.0 5GT/s - IB QDR / 10GigE] (rev a0)
        Link Width: 8x
        Link Speed: 2.5Gb/s


Installation finished successfully. 

The firmware version 2.6.0 is up to date. 
Note: To force firmware update use '--force-fw-update' flag.
Configuring /etc/security/limits.conf. 
warning: /etc/infiniband/openib.conf saved as /etc/infiniband/openib.conf.rpmsave

Wednesday, July 14, 2010

How To Build the ATI Fglrx kernel modules for a new CentOS 5 kernel

RHEL5 / CentOS5 kernel update time can be troublesome with regards to workstation video cards.

Especially if you are dealing with 10's of 100's of workstations, a simple 'yum update' can result in a large number of support calls stating, "I rebooted my workstation, and now it reports that X can't start!"

Workstations with nVidia based cards can use the kmod RPMs provided by the ELRepo repository (is that redundant?).

Unfortunately, there aren't kmod RPMs for ATI Radeon cards (fglrx). Until I get around to rolling my own kmod RPM, here's the solution I use (I originally posted this script on this blog post):

  1. Many kernels ago, I had built an RPM using the ati-driver installation package and installed the RPM
  2. 
    $ sh ati-driver-installer-9-3-x86.x86_64.run --buildpkg RedHat/RHEL5_64a
    $ sudo rpm -Uvh fglrx64_7_1_0-8.593-1.x86_64.rpm
    
  3. Create a script that will build a new kernel module based on the currently loaded kernel: /root/fglrx_build_kernel_module.sh
  4. 
    #!/bin/sh
    # Builds updated kernel module (based on currently loaded kernel)
    # 
    # This driver was installed via RPM, built using:
    # sh ati-driver-installer-9-3-x86.x86_64.run --buildpkg RedHat/RHEL5_64a
    
    # fix the source code to work with CVE-2010-3081
    /usr/bin/perl -pi -e 's/return compat_alloc_user_space/return arch_compat_alloc_user_space/g;' /lib/modules/fglrx/build_mod/kcl_ioctl.c
    
    cd /lib/modules/fglrx/build_mod
    ./make.sh
    
    cd /lib/modules/fglrx
    ./make_install.sh
    
    echo "To complete the process you must 'init 3' and 'init 5'"
    echo "lsmod | grep fglrx"
    
  5. Update the kernel followed by a reboot and you'll notice that X fails to start and that the fglrx module is not loaded. Enter runlevel 3, and run the script
  6. 
    # lsmod | grep fglrx
    
    # init 3
    # sh ./fglrx_build_kernel_module.sh
    
    
    AMD kernel module generator version 2.1
    doing Makefile based build for kernel 2.6.x and higher
    rm -rf *.c *.h *.o *.ko *.GCC* .??* *.symvers
    make -C /lib/modules/2.6.18-194.8.1.el5/build SUBDIRS=/lib/modules/fglrx/build_mod/2.6.x modules
    make[1]: Entering directory `/usr/src/kernels/2.6.18-194.8.1.el5-x86_64'
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/firegl_public.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_acpi.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_agp.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_debug.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_ioctl.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_io.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_pci.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_str.o
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/kcl_wait.o
      LD [M]  /lib/modules/fglrx/build_mod/2.6.x/fglrx.o
      Building modules, stage 2.
      MODPOST
      CC      /lib/modules/fglrx/build_mod/2.6.x/fglrx.mod.o
      LD [M]  /lib/modules/fglrx/build_mod/2.6.x/fglrx.ko
    make[1]: Leaving directory `/usr/src/kernels/2.6.18-194.8.1.el5-x86_64'
    build succeeded with return value 0
    duplicating results into driver repository...
    done.
    You must change your working directory to /lib/modules/fglrx
    and then call ./make_install.sh in order to install the built module.
    - recreating module dependency list
    - trying a sample load of the kernel modules
    done.
    To complete the process you must 'init 3' and 'init 5'
    
  7. Once the script finishes, enter runlevel 5 and verify that the fglrx module is loaded
  8. 
    # init 5
    
    # lsmod | grep fglrx
    fglrx                2389736  3 
    

To Do: Rewrite the script to build the kernel module for whichever kernel you specify instead of only the currently loaded kernel. nVidia provides support for this, for example to build the module for the latest EL5 kernel:

# sh NVIDIA-Linux-x86_64-190.42-pkg2.run -a -K -k 2.6.18-194.8.1.el5

Tuesday, July 13, 2010

VMware Announces the Release of vSphere 4.1

The release over can be found on this page.

The page is mostly sales jargon, but does contain one interesting tidbit that ESX will not be supported after this release!

"For planning purposes, it is important to know that vSphere 4.1 is the last vSphere release to support both ESX and ESXi hypervisor architectures; all future releases of vSphere will only support the ESXi architecture"

Also, some exciting news for Essentials Plus users:

"VMware vMotion™ is now included in the Essentials Plus and Essentials for Retail & Branch Offices kits, as well as in vSphere Standard edition."

Wednesday, June 23, 2010

Installing an Subversion 1.6 and Trac 0.12 server on CentOS 5.5

These are some notes that I took while setting up a new server to run Subversion 1.6.11 and Trac 0.12 on CentOS 5.5

I'm not claiming this is the perfect setup (it's probably far from that). I had a short window in which to get a dead SVN physical server back online as a VMware ESXi virtual machine.

The old server ran a very old install of Gentoo and SVN 1.1.3 along with Trac 0.9.3.

This server is also only access via a local network.

As always, feedback is welcome.

If I had the time, I would have preferred to build RPMs for each of the installed components...

Kickstart


# Kickstart file automatically generated by anaconda.
# boot: linux ks=http://<kickstart-source>/kickstart/svnsrv-centos5.cfg
#       ip=10.0.1.10 netmask=255.255.255.0 gateway=10.0.1.1 nameserver=10.0.1.1
# Subverions repository server

install
#cdrom
url --url http://mirror.mydom/distro-trees/centos-5-i386
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
text

network --device eth0 --bootproto static --ip 10.0.1.10 --netmask 255.255.255.0 --gateway 10.0.1.1 --nameserver 10.0.1.1 --hostname svnsrv.mydom
rootpw --iscrypted xxxxxxxxxxxxxxxxxxxx
reboot
# Ports to open on the firewall, tcp port 5666 is for nagios client
firewall --enabled --port=22:tcp --port=443:tcp
selinux --enforcing
authconfig --enableshadow --enablemd5 --enableldapauth --enableldaptls --ldapserver ldap.mydom --ldapbasedn dc=my,dc=dom
timezone --utc America/Chicago
# For Virtual Machines, see this VMware KB to determine what grub setting (if any) is needed
# to keep the time in sync
# http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427
#   32bit: --append="clock=pit"
#   32bit RHEL 5.4:     --append="divider=10"
#         RHEL 5.3,2,1: --append="clocksource=acpi_pm divider=10"
#   64bit RHEL 5.4:     --append="divider=10"
#         RHEL 5.3,2,1: --append="notsc divider=10"
bootloader --location=mbr --md5pass=xxxxxxxxxxxxxxxxxxxxxx --append="rhgb quiet divider=10"
clearpart --all --drives=sda --initlabel
part /boot --fstype ext3 --size=256 --ondisk=sda
part pv.2 --size=0 --grow --ondisk=sda
volgroup vg_svnsrv --pesize=32768 pv.2
part pv.3 --size=0 --grow --ondisk=sdb
volgroup vg_backup --pesize=32768 pv.3
logvol swap  --fstype swap --name=lv_swap  --vgname=vg_lmgr --recommended
logvol /var --fstype ext4 --name=lv_var --vgname=vg_svnsrv --size=4096
logvol /tmp --fstype ext3 --name=lv_tmp --vgname=vg_svnsrv --size=1024
logvol / --fstype ext4 --name=lv_root --vgname=vg_svnsrv --size=20480
logvol /home --fstype ext4 --name=lv_home --vgname=vg_svnsrv --size=1024 --grow
logvol /backup --fstype ext4 --name=lv_backup --vgname=vg_backup --size=1024 --grow

%packages --resolvedeps --nobase
# Minimal components to install
NetworkManager
audit
bzip2
crontabs
dhclient
logrotate
mailx
man
ntp
openssh
openssh-clients
openssh-server
pam_passwdqc
postfix
psacct
screen
sudo
tcpdump
telnet
wget
which
yum
# Additional tools
@development-libs
kernel-devel
rsync
gcc
vim-enhanced
make
autoconf
libtool
httpd
httpd-devel
mod_ssl
db4
db4-devel
db4-utils
db4-tcl
tcsh
# Needed to allow ldap authentication for BlazerIds
nss_ldap
nscd
# remove these
-rwho
-rusers
-sysreport
-system-config-httpd
-system-config-nfs
-system-config-samba

%post
###########################################################
### Create script to configure the server at first boot ###
###########################################################
/sbin/chkconfig ntpd on
/sbin/service ntpd start

########################################
# Enable/Disable Services
/sbin/chkconfig smartd on
/sbin/chkconfig isdn off
/sbin/chkconfig pcmcia off
/sbin/chkconfig openibd off

########################################
# Add user accounts (no passwords, let ldapauth handle that
/usr/sbin/authconfig --kickstart --enablelocauthorize
/usr/sbin/groupadd -g 10000 flakrat
/usr/sbin/useradd -u 10000 -g 10000 -c "FlakRat's Rat House" flakrat
/usr/sbin/usermod -a -G wheel flakrat
/bin/sed -i 's/^# \(%wheel\tALL=(ALL)\tALL\)$/\1/' /etc/sudoers

# Perform a full update
/bin/rm -rf /var/cache/yum/*
/usr/bin/yum clean all
rm -rf /etc/yum.repos.d/*

/usr/bin/yum -y update 2>&1 > /root/yum-update.log

##########################################
#Return rc.local back to the original copy so we don't rerun this each reboot
/bin/mv /etc/rc.d/rc.local /etc/rc.d/rc.local.firstboot
/bin/mv /etc/rc.d/rc.local.sav /etc/rc.d/rc.local

# Reboot the system to pick up all the updates
/sbin/shutdown -r now

EOF3
# make configuration script executable
chmod +x /root/postinstall-config.sh

#####################################################
# save a copy of rc.local
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.sav

# add postinstall-config.sh to rc.local
cat >> /etc/rc.d/rc.local <<EOF
/root/postinstall-config.sh
EOF
#


Once the kickstart is complete, install the VMware tools and enable puppet client.

After which, add the SVN admin users to the svnadmin group and provide access to the svn home

$ sudo /usr/sbin/usermod -a -G svnadmin flakrat
$ sudo /usr/sbin/usermod -a -G svnadmin otheruser
$ sudo /usr/sbin/usermod -a -G svnadmin apache


$ sudo chmod g+rwx /home/svn
$ sudo chmod g+s /home/svn

Http Server

Self Signed Certificate

  1. Create a working directory to create the certificates (the symlinks are simply helpful reminders for where the cert and key will be stored)
    
    $ sudo su -
    # mkdir /root/certificates
    # cd /root/certificates
    # ln -s /etc/pki/tls/private
    # ln -s /etc/pki/tls/certs
    
    
  2. Generate the new SSL private key
    
    # openssl genrsa 4096 > svnsrv.mydom.key
    
    Generating RSA private key, 4096 bit long modulus
    .......................................................................................................................................................................++
    .................................++
    e is 65537 (0x10001)
    
    
  3. Generate the self signed certificate (make sure that the common name is correct, otherwise newer browsers will reject the cert!)
    
    # openssl req -new -key svnsrv.mydom.key -x509 -days 3650 -out svnsrv.mydom.crt
    
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [GB]:US
    State or Province Name (full name) [Berkshire]:Texas
    Locality Name (eg, city) [Newbury]:College Station
    Organization Name (eg, company) [My Company Ltd]:Some Company
    Organizational Unit Name (eg, section) []:Some Department
    Common Name (eg, your name or your server's hostname) []:svnsrv.mydom
    Email Address []:flakrat@mydom
    
    
  4. Copy the cert and key to the correct location
    
    # chmod 600 svnsrv.*
    # cp svnsrv.mydom.crt /etc/pki/tls/certs/
    
    # cp svnsrv.mydom.key /etc/pki/tls/private/
    
    
  5. Edit ssl.conf to use the new cert and key
    
    # vim /etc/httpd/conf.d/ssl.conf 
    
    SSLEngine on
    
    #SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateFile /etc/pki/tls/certs/svnsrv.mydom.crt
    
    #SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
    SSLCertificateKeyFile /etc/pki/tls/private/svnsrv.mydom.key
    
    
  6. Restart apache



Python

  1. Download the latest Python software (the OS installed version is 2.4.x, we'll use 2.6.5)
    
    $ sudo mkdir /opt/python
    $ sudo chown flakrat:flakrat /opt/python
    
    $ mkdir ~/software/python
    $ cd ~/software/python
    $ wget http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2
    $ wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
    $ tar -jxf Python-2.6.5.tar.bz2
    
    
  2. Compile Python and install it
    
    $ cd Python-2.6.5
    $ make clean
    $ ./configure --prefix=/opt/python
    $ make
    
    Failed to find the necessary bits to build these modules:
    _tkinter           bsddb185           sunaudiodev     
    To find the necessary bits, look in setup.py in detect_modules() for the module's name.
    
    $ make install
    
    
  3. Install setuptools
    
    $ alias python="/opt/python/bin/python2.6"
    $ export PATH=/opt/python/bin:$PATH
    
    $ python -V
    Python 2.6.5
    
    $ cd ~/software/python
    $ sh setuptools-0.6c11-py2.6.egg
    
    Processing setuptools-0.6c11-py2.6.egg
    Copying setuptools-0.6c11-py2.6.egg to /opt/python/lib/python2.6/site-packages
    Adding setuptools 0.6c11 to easy-install.pth file
    Installing easy_install script to /opt/python/bin
    Installing easy_install-2.6 script to /opt/python/bin
    
    Installed /opt/python/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
    Processing dependencies for setuptools==0.6c11
    Finished processing dependencies for setuptools==0.6c11
    
    
  4. Install a new mod_python
    
    $ alias python="/opt/python/bin/python2.6"
    
    $ cd ~/software/python
    $ wget http://mirrors.ecvps.com/apache/httpd/modpython/mod_python-3.3.1.tgz
    $ tar -zxf mod_python-3.3.1.tgz
    $ cd mod_python-3.3.1
    $ ./configure --with-apxs=/usr/sbin/apxs
    $ make
    
    make[1]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1'
    make[2]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1/src'
    make[2]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1/src'
    make[2]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1/dist'
    make[2]: `build' is up to date.
    make[2]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1/dist'
    
    Now su and make install
      (or, if you only want to perform a partial install,
       you can use make install_dso and make install_py_lib)
    
    $ make install
    
    Performing DSO installation.
    
    /usr/bin/install -c -d /usr/lib/httpd/modules
    /usr/bin/install: cannot change permissions of `/usr/lib/httpd/modules': Operation not permitted
    make[1]: *** [install_dso] Error 1
    make[1]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1'
    make[1]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1'
    cd dist && make install_py_lib
    make[2]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1/dist'
    make[3]: Entering directory `/home/flakrat/software/python/mod_python-3.3.1/src'
    make[3]: `psp_parser.c' is up to date.
    make[3]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1/src'
    if test -z "" ; then \
      /opt/python/bin/python setup.py install --optimize 2 --force ; \
     else \
      /opt/python/bin/python setup.py install --optimize 2 --force --root  ; \
     fi
    running install
    running build
    running build_py
    running build_ext
    running install_lib
    creating /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/util.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/cache.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/psp.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/cgihandler.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/_psp.so -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/publisher.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/importer.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/__init__.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/testhandler.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/python22.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/Cookie.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/Session.py -> /opt/python/lib/python2.6/site-packages/mod_python
    copying build/lib.linux-i686-2.6/mod_python/apache.py -> /opt/python/lib/python2.6/site-packages/mod_python
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/util.py to util.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/cache.py to cache.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/psp.py to psp.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/cgihandler.py to cgihandler.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/publisher.py to publisher.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/importer.py to importer.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/__init__.py to __init__.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/testhandler.py to testhandler.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/python22.py to python22.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/Cookie.py to Cookie.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/Session.py to Session.pyc
    byte-compiling /opt/python/lib/python2.6/site-packages/mod_python/apache.py to apache.pyc
    writing byte-compilation script '/tmp/tmpgowmQp.py'
    /opt/python/bin/python -OO /tmp/tmpgowmQp.py
    removing /tmp/tmpgowmQp.py
    running install_egg_info
    Writing /opt/python/lib/python2.6/site-packages/mod_python-3.3.1-py2.6.egg-info
    make[2]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1/dist'
    make[1]: Leaving directory `/home/flakrat/software/python/mod_python-3.3.1'
    
    
  5. Now copy the new mod_python.so library to the httpd modules folder
    
    $ sudo cp ~/software/python/mod_python-3.3.1/src/.libs/mod_python.so \
     /etc/httpd/modules/mod_python26.so
    
    
  6. edit python.conf to point to the new library
    
    $ sudo vim /etc/httpd/conf.d/python.conf
    
    
    
    #
    # Mod_python is a module that embeds the Python language interpreter
    # within the server, allowing Apache handlers to be written in Python.
    #
    
    # 20100614 - MJH replacing system mod_python with recompiled version for python 2.6
    #LoadModule python_module modules/mod_python.so
    LoadModule python_module modules/mod_python26.so
    
    # Override type-map handler for /var/www/manual
    <Directory "/var/www/manual/mod/mod_python">
     <Files *.html>
      SetHandler default-handler
     </Files>
    </Directory>
    
    # This will cause files beneath /var/www/html with the extension .spam
    # to be handled by the Python script /var/www/html/eggs.py
    #
    #<Directory /var/www/html>
    #    AddHandler python-program .spam
    #    PythonHandler eggs
    #</Directory>
    
    # This will cause all requests to the /python heirachy of your
    # webserver to be handled by the python script /path/to/myhandler.py
    #
    #<Location /python>
    #    SetHandler python-program
    #    PythonPath "sys.path + ['/path/to']"
    #    PythonHandler myhandler
    #</Location>
    
    # This will cause all requests to the /python hierachy of your
    # webserver to be handled by mod_python's Publisher handler
    # (see http://localhost/manual/mod/mod_python/hand-pub.html)
    #
    #<Location /python>
    #    SetHandler python-program
    #    PythonHandler mod_python.publisher
    #</Location>
    
    # This will cause the output of all requests to files beneath
    # /var/www/html with the extension .flt to be filtered through
    # the Python script /var/www/html/filter.py
    #
    #<Directory /var/www/html>
    #    PythonOutputFilter filter MYFILTER
    #    AddOutputFilter MYFILTER .flt
    #</Directory>
    
    # This will enable use of "Python Server Pages", HTML pages with
    # inline Python code which is interpreted by the server:
    #
    #<Directory /var/www/html>
    #    AddHandler mod_python .psp
    #    PythonHandler mod_python.psp
    #</Directory>
    
    
  7. Restart the httpd service
  8. Set up the profile scripts to use the new python and trac
    
    $ sudo vim /etc/profile.d/trac-12.sh
    
    
    
    #!/bin/sh
    alias python="/opt/python/bin/python2.6"
    export PATH=/opt/python/bin:$PATH
    
    
    
    #!csh
    $ sudo vim /etc/profile.d/trac-12.csh
    
    
    
    #!/bin/tcsh
    alias python '/opt/python/bin/python2.6'
    setenv PATH "/opt/python/bin:${PATH}"
    
    

Subversion

This section documents the installation of Subversion 1.6.x. CentOS 5 comes with 1.4.x.
  1. Create the install location
    
    $ sudo mkdir /opt/subversion
    $ sudo chown -R flakrat:flakrat /opt/subversion
    
    
  2. Download Subversion
    
    $ mkdir -p ~/software/subversion
    $ cd ~/software/subversion
    $ wget http://subversion.tigris.org/downloads/subversion-1.6.11.tar.bz2
    $ wget http://subversion.tigris.org/downloads/subversion-deps-1.6.11.tar.bz2
    $ tar -jxf subversion-1.6.11.tar.bz2
    $ tar -jxf subversion-deps-1.6.11.tar.bz2
    
    
  3. Compile Subversion (during 'make check' XFAILs are expected failures that are sort of like a TODO for the SVN developers), the 'make swig-py' will build the SVN Python libraries
    
    $ . /etc/profile.d/trac-12.sh
    $ cd subversion-1.6.11
    $ make clean
    $ sh ./autogen.sh
    
    $ ./configure \
      --prefix=/opt/subversion \
      --with-apr=/usr/bin/apr-1-config \
      --with-apr-util=/usr/bin/apu-1-config \
      --with-apxs=/usr/sbin/apxs
    
    $ make
    $ make check
    $ sudo make install
    
    $ make swig-py
    $ sudo make install-swig-py 
    
    
  4. Copy the Python libraries to the Python directory
    
    $ cp -a /opt/subversion/lib/svn-python/{svn,libsvn} \
      /opt/python/lib/python2.6/site-packages/
    
    
  5. Create the profile scripts
    * Bash
    
    $ sudo vim /etc/profile.d/svn.sh
    
    
    
    #!/bin/sh
    export PATH=/opt/subversion/bin:$PATH
    export LD_LIBRARY_PATH=/opt/subversion/lib:$LD_LIBRARY_PATH
    
    
    * CSH
    
    $ sudo vim /etc/profile.d/svn.csh
    
    
    
    #!/bin/tcsh
    setenv PATH "/opt/subversion/bin:${PATH}"
    setenv LD_LIBRARY_PATH "/opt/subversion/lib:${LD_LIBRARY_PATH}"
    
    
  6. Edit the yum.conf file to exclude subverion and mod_dav_svn from being installed
    
    $ sudo vim /etc/yum.conf
    
    
    
    [main]
    cachedir=/var/cache/yum
    keepcache=0
    debuglevel=2
    logfile=/var/log/yum.log
    distroverpkg=redhat-release
    tolerant=1
    exactarch=1
    obsoletes=1
    gpgcheck=1
    plugins=1
    
    exclude=subversion,mod_dav_svn
    
    # Note: yum-RHN-plugin doesn't honor this.
    #metadata_expire=1h
    
    # Default.
    # installonly_limit = 3
    
    # PUT YOUR REPOS HERE OR IN separate files named file.repo
    # in /etc/yum.repos.d
    
  7. The Subversion repositories on the old svn server used BDB format. Newer version of Subversion use FSFS as the standard. In order to facilitate migrating the repos to the new server I had to first dump the repos (these commands were run on my old server where repos were stored in ~svn/repositories):
    
    $ cd ~svn/repositories
    $ for n in $(ls); do \
     if [ -d $n ]; then echo "Dumping: $n"; \
       svnadmin dump ${n} | gzip -c > /backups/dumps/${n}.dmp.gz ; \
    fi; done
    
  8. Create md5sum checksums of each dump file (also run on the old server)
    
    $ cd /backups/dumps
    $ find $@ ! -type d -print0 | xargs -0 md5sum > /backups/MD5SUMS.svn.dumps 
    
  9. Copy the dumps and check sum file from the old server and verify the dump files (commands run on the new server)
    
    $ mkdir ~svn/dumps
    $ rsync -a oldserver:/backups/dumps/ ~svn/dumps/
    $ rsync -a oldserver:/backups/MD5SUMS.svn.dumps ~svn/
    $ cd ~svn/dumps
    $ md5sum -c ~svn/MD5SUMS.svn.dumps | grep -v OK$
    
  10. If everything checks out, the md5sum command shouldn't produce any output since we are greping out lines ending in OK
  11. Load the Subversion repositories from their gzip compressed dump files
    
    $ cd ~svn/dumps
    $ sudo mkdir -p /var/lib/svn/repos
    $ sudo chown -R svn:svnadmin /var/lib/svn
    $ sudo chmod -R g+rwxs /var/lib/svn
    
    $ for n in $(ls | awk -F. '{print $1}'); do \
      svnadmin create /var/lib/svn/repos/$n ; \
      gunzip -c ${n}.dmp.gz | svnadmin load /var/lib/svn/repos/$n ; \
    done
    
  12. Next verify the repositories
    
    $ cd /var/lib/svn/repos
    $ for n in $(ls); do svnadmin verify $n ; done
    
    

Trac

  1. Source the trac environment script
    
    $ . /etc/profile.d/trac-12.sh
    
    
  2. Install Genshi
    
    $ easy_install Genshi
    
    Searching for Genshi
    Reading http://pypi.python.org/simple/Genshi/
    Reading http://genshi.edgewall.org/
    Reading http://genshi.edgewall.org/wiki/Download
    Best match: Genshi 0.6
    Downloading http://ftp.edgewall.com/pub/genshi/Genshi-0.6-py2.6.egg
    Processing Genshi-0.6-py2.6.egg
    Moving Genshi-0.6-py2.6.egg to /opt/python/lib/python2.6/site-packages
    Adding Genshi 0.6 to easy-install.pth file
    
    Installed /opt/python/lib/python2.6/site-packages/Genshi-0.6-py2.6.egg
    Processing dependencies for Genshi
    Finished processing dependencies for Genshi
    
    
  3. Install Trac 0.12 using easy_install
    
    $ easy_install Trac==0.12
    
    Searching for Trac==0.12
    Reading http://pypi.python.org/simple/Trac/
    Reading http://trac.edgewall.org/
    Reading http://trac.edgewall.org/wiki/TracDownload
    Reading http://trac.edgewall.com/
    Reading http://projects.edgewall.com/trac
    Reading http://projects.edgewall.com/trac/wiki/TracDownload
    Best match: Trac 0.12
    Downloading ftp://ftp.edgewall.com/pub/trac/Trac-0.12.zip
    Processing Trac-0.12.zip
    Running Trac-0.12/setup.py -q bdist_egg --dist-dir /tmp/easy_install-m7d5G7/Trac-0.12/egg-dist-tmp-gqKlcr
    Adding Trac 0.12 to easy-install.pth file
    Installing trac-admin script to /opt/python/bin
    Installing tracd script to /opt/python/bin
    
    Installed /opt/python/lib/python2.6/site-packages/Trac-0.12-py2.6.egg
    Processing dependencies for Trac==0.12
    Finished processing dependencies for Trac==0.12
    
    
  4. Install the Git plugin (for future support of Git repos on this server)
    
    $ easy_install http://trac-hacks.org/svn/gitplugin/0.12
    
    Downloading http://trac-hacks.org/svn/gitplugin/0.12
    Doing subversion checkout from http://trac-hacks.org/svn/gitplugin/0.12 to /tmp/easy_install-9ULtKC/0.12
    Processing 0.12
    Running setup.py -q bdist_egg --dist-dir /tmp/easy_install-9ULtKC/0.12/egg-dist-tmp-iTzr9l
    warning: install_data: setup script did not provide a directory for 'COPYING' -- installing right in 'build/bdist.linux-i686/egg'
    warning: install_data: setup script did not provide a directory for 'README' -- installing right in 'build/bdist.linux-i686/egg'
    zip_safe flag not set; analyzing archive contents...
    Adding TracGit 0.12.0.2dev-r7757 to easy-install.pth file
    
    Installed /opt/python/lib/python2.6/site-packages/TracGit-0.12.0.2dev_r7757-py2.6.egg
    Processing dependencies for TracGit==0.12.0.2dev-r7757
    Finished processing dependencies for TracGit==0.12.0.2dev-r7757
    
    
  5. Install TOCMacro http://trac-hacks.org/wiki/TocMacro (the version for 0.11 appears to work, we'll use it until 0.12 toc releases)
    
    $ easy_install http://trac-hacks.org/svn/tocmacro/0.11
    
    
  6. Install pygments for syntax highlighting
    
    $ easy_install pygments
    Searching for pygments
    Reading http://pypi.python.org/simple/pygments/
    Reading http://pygments.org/
    Reading http://pygments.pocoo.org/
    Best match: Pygments 1.3.1
    Downloading http://pypi.python.org/packages/2.6/P/Pygments/Pygments-1.3.1-py2.6.egg#md5=05270ee059c038407364b28993980960
    Processing Pygments-1.3.1-py2.6.egg
    creating /opt/python/lib/python2.6/site-packages/Pygments-1.3.1-py2.6.egg
    Extracting Pygments-1.3.1-py2.6.egg to /opt/python/lib/python2.6/site-packages
    Adding Pygments 1.3.1 to easy-install.pth file
    Installing pygmentize script to /opt/python/bin
    
    Installed /opt/python/lib/python2.6/site-packages/Pygments-1.3.1-py2.6.egg
    Processing dependencies for pygments
    Finished processing dependencies for pygments
    
    
  7. Change ownership of the python install
    
    $ sudo chown -R root:root /opt/python
    
    

Trac Pages

This section will document how to configure trac and convert each to use the updated format for version 0.12
  1. Copy the old trac instances to /var/www/trac (during the install I staged all of the files in /backup/oldsrv)
    
    $ sudo mkdir /var/www/trac
    $ sudo rsync -a /backup/oldsrv/var/www/trac/ /var/www/trac/
    $ sudo chown -R apache:apache /var/www/trac
    
    
  2. Upgrade the trac instances to the current format
    
    $ for n in $(ls); do \
      sudo trac-admin /var/www/trac/$n upgrade; \
      sudo trac-admin /var/www/trac/$n wiki upgrade; \
      sudo trac-admin /var/www/trac/$n repository '*'; \
     done
    
    
  3. Create the trac.conf httpd file
    
    $ sudo vim /etc/httpd/conf.d/trac.conf
    
    
    
    <Location /trac>
      SetHandler mod_python
      PythonHandler trac.web.modpython_frontend
      PythonOption TracEnvParentDir /var/www/trac
      PythonOption TracUriRoot /trac
    </Location>
    
    <LocationMatch /trac/[^/]+/login>
      AuthType Basic
      AuthName "trac"
      AuthUserFile /var/lib/svn/repos/repousers
      Require valid-user
    </LocationMatch>