This guide is for installing Trac as a user using virtualenv for a isolated Python environment so that the whole installation runs under a specific user.
First of all we need to install needed packages
1apt-get install libapache2-mod-wsgi python-virtualenv python-setuptools
Once we have installed the required packages proceed to create the Python environment
1mkdir /usr/local/trac
2cd /usr/local/trac
3virtualenv python
We now have the isolated Python environment locate under /usr/local/trac/python.
To make possible to use easy_install with repositories we need to upgrade easy_install. I use this to install Trac plugins directly from SVN.
1/usr/local/trac/python/bin/easy_install -U trunk
We now can install trac 0.12 using the 0.12b1 SVN Tag (http://svn.edgewall.com/repos/trac/tags/trac-0.12b1 or Trac==0.12b1) or directly from SVN Trunk:
1/usr/local/trac/python/bin/easy_install http://svn.edgewall.org/repos/trac/trunk
This will download and install the latest trunk version for Trac.
To have webaccess to the Trac projects, we need a .wsgi script, were we define where our local python environment is located:
1# Not needed if mod_wsgi >= 3.0
2import sys
3sys.stdout = sys.stderr
4
5# Load Trac
6import trac.web.main
7application = trac.web.main.dispatch_request
And finally we need to configure apache. If you want only one Trac project, you should define trac.env to the location of your trac, but if you want multiproject support, you must use trac.env_parent_dir (this is what I used)
|
|
We need to create the user and change the permissions for /usr/local/trac for that user trac
1adduser --home /usr/local/trac --shell /bin/false --no-create-home trac
2chown -R trac:trac /usr/local/trac
If you get an error “ImportError: No module named simplejson” just install it using easy_install
1/usr/local/trac/python/bin/easy_install simplejson