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
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
wget -c

Build new mod_python with python 2.6

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

Move new mod_python and modify the python.conf

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

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 *