[[PageOutline(2-5,Contents,pullout)]]
= Trac 11rc1 + MySQL + mod_python on Slackware 12.1
This guide lists the steps to install Trac on [http://www.slackware.com/ Slackware 12.1] with [http://www.mysql.com/ MySQL] and [http://modpython.org/ mod_python].
== Subversion with SWIG
One of the requirements is that Subversion is compiled with [http://www.swig.org/ SWIG] support. Therefore if you are using the supplied package, then you will need to recompile as follows:
* Remove installed Subversion package.
* Compile and install SWIG from [http://slackbuilds.org/ slackbuilds].
* Get Subversion build scripts and source from source cd.
* Edit build script and include `--with-swig` in configuration options.
* Recompile Subversion and install new Subversion package.
* In Subversion source directory (probably in /tmp) do:
{{{#!sh
make swig-py
make install-swig-py
}}}
== Trac installation
Once subversion has been recompiled Trac installation can proceed. First install ez_setup:
{{{#!sh
python ez_setup.py
}}}
Next install Genshi:
{{{#!sh
easy_install Genshi
}}}
And finally Trac:
{{{#!sh
easy_install Trac==0.11rc1
}}}
== MySQL
* Install MySQL package from Slackware, make sure everything is up and running before proceeding.
* Compile and install pysetuptools from slackbuilds.
* Compile and install mysql-python from slackbuilds.
* Set-up the Trac database:
{{{#!sql
mysql -u root -p
CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE trac;
CREATE USER tracuser IDENTIFIED BY 'password';
GRANT ALL ON trac.* TO tracuser;
}}}
For the above example the connection string will be: `mysql://tracuser:password@localhost/trac`.
== Set-up Trac
Create Trac project:
{{{#!sh
trac-admin /path/to/myproject initenv
}}}
== Apache setup
* Compile and install mod_python from http://slackbuilds.org/ slackbuilds].
* Configure Apache to test Python installation, add the following to `httpd.conf` (location only for tests):
{{{#!apache
LoadModule python_module lib/httpd/modules/mod_python.so
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler mod_python.testhandler
}}}
* '''IMPORTANT''': Make sure PYTHONPATH is set and that apache can see it:
{{{#!sh
export PYTHONPATH=$PYTHONPATH:/usr/lib/svn-python
}}}
* Restart Apache.
* Point browser to `http://localhost/mpinfo`: you should see info and if so location can now be removed.
* Next add to `httpd.conf` Virtualhost config or any other setup you would like.
'''Note''': add this VirtualHost config for multiple projects:
{{{#!apache
DocumentRoot /path/to/trac
Allow from all
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /path/to/trac
PythonOption TracUriRoot /
# used for authentication (refer to manual for more info)
#
# AuthName "Trac"
# AuthType Basic
# AuthUserFile /path/to/trac/.htpasswd
# Require valid-user
# Options FollowSymLinks
# Order allow,deny
# Allow from all
#
}}}
* Restart Apache.
* Point to virtualhost and all should be working.
Hope this helps,
icebrian