CentOS 5.x comes packaged with Python 2.4, if you’re developing software with another version of Python you’re going to want to do one of two things. You can either thoroughly test your application against Python 2.4 or you can install the same version of Python that the software was written with. In my case I’ve been using Python2.5 so I’ll be configuring my server to use that instead.
Installing the required packages
First we’re going to have to make sure we have all the development tools and libraries required to configure and compile our source code correctly.
sudo yum update
sudo yum groupinstall 'Development Tools' 'Development Libraries'
sudo yum install tk-devel libjpeg-devel mysql-devel python-devel httpd-devel zlib-devel bzip2-devel
Installing Python 2.5
Python 2.4 is an essential package for any CentOS 5.x deployment. In fact if you uninstall Python 2.4 yum will cease to work properly. So instead of replacing the default CentOS package let’s install Python 2.5 into the /opt directory, which historically has been used for installing optional software.
sudo mkdir /opt/src
cd /opt/src
sudo wget http://python.org/ftp/python/2.5.4/Python-2.5.4.tgz
sudo tar xzvf Python-2.5.4.tgz
Next we’ll be compiling Python with a few extra flags. The first —prefix tells the make file which directory to install Python in. The second —enable-thread will enable Python’s threading libraries for use with mod_wsgi which uses threading to serve http request concurently. The —enabled-shared flag will be used in compiling mod_wsgi allowing access to Python 2.5 shared libraries. And finally —enable-unicode allows us to enable unicode ucs4 instead of the default ucs2.
full article: http://binarysushi.com/blog/2009/aug/19/CentOS-5-3-python-2-5-virtualevn-mod-wsgi-and-mod-rpaf/
Categories: Linux



