Since mod_wsgi isn’t available as an official pre-compiled package for Ubuntu Gutsy (but see below), we have to compile it from source manually and install it ourselves. Although I used mod_wsgi 2.0c4 in the example below, you can follow the same directions and install the stable version, 1.3. This tutorial uses Apache 2 and Python 2.5.
If you have any problems, read the Installation Issues page on the mod_wsgi Wiki.
Before we can begin, we need to have some packages installed:
sudo aptitude install build-essential apache2-dev python2.5-dev
As a regular user, run these commands:
1. mkdir ~/src && cd ~/src 2. wget http://modwsgi.googlecode.com/files/mod_wsgi-2.0c4.tar.gz 3. tar zxvf mod_wsgi-2.0c4.tar.gz && cd mod_wsgi-2.0c4 4. ./configure && make && sudo make install
Now that the mod_wsgi module is installed on our system, we have to create a .load file for it:
sudo echo "LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so" > /etc/apache2/mods-available/wsgi.load
We must now tell Apache to load the mod_wsgi module. First, type:
sudo a2enmod
At the prompt, type “wsgi” and hit enter.
Finally, we just need to restart Apache and everything should be good to go:
sudo /etc/init.d/apache2 restart
A binary package for Gutsy on amd64 is available at http://sw.fairviewcomputing.com/ubuntu/. I’m using it on my Slice, but if you have trouble with it, or need a version other than 2.0, this tutorial shows how easy mod_wsgi is to build.