Install/Upgrade Trac on CentOS 5.5 with Python2.6

I recently had to upgrade our production Subversion/Trac server to use Python2.6. Normally with yum, this wouldn’t be such a big deal, but python2.6 is not in the CentOS repos. And specifically, I needed Trac built with python2.6 support. So I grabbed python from the EPEL repos. You do NOT want to remove the installed version of python(2.4). RedHat/CentOS is extremely dependent on python. It is best to leave the current version installed, and alias the python command.

Keep in mind, this is an upgrade on a production server. To start, take the server offline.

service httpd stop

Add EPEL repos, install python26, python26-devel, httpd-devel

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-5.noarch.rpm
yum install python26-devel.x86_64 httpd-devel

Remove previously installed Trac, Genshi and Python 2.4 Setuptools

yum remove trac
yum remove python-setuptools.noarch

Alias python26 in .bashrc (so that any python commands will use the correct version of python)

vim .bashrc
+alias python='/usr/bin/python26'
source .bashrc

Check your python version

python -V (should be 2.6)

Download setuptools, mod_python – URLs may change

wget -c http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
wget -c http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz

Build new mod_python with python 2.6

./configure --with-python=/usr/bin/python26
make
make install

Move new mod_python and modify the python.conf

mv src/.libs/mod_python.so /etc/httpd/modules/mod_python26.so
vim /etc/httpd/conf.d/python.conf
- LoadModule python_module modules/mod_python.so
+ LoadModule python_module modules/mod_python26.so

Install new setup-tools

sh setuptools-0.6c11-py2.6.egg

Install Genshi, Bable, Pigments, Trac

easy_install Genshi
easy_install Babel
easy_install pygments
easy_install trac==0.12

Put the original trac.conf back after removing Trac

cp /etc/httpd/conf.d/trac.conf.rpmsave /etc/httpd/conf.d/trac.conf

Update the sites if needed:

trac-admin /path/to/trac/site upgrade
trac-admin /path/to/trac/site wiki upgrade

Restart Apache

service httpd restart

Last, I added the package names to my /etc/yum.conf file so that yum will never try to upgrade them since I installed them outside of the packaging system.

exclude=python-setuptools* python-genshi* mod_python* subversion* mod_dav_svn*

Leave a Reply

Your email address will not be published. Required fields are marked *