How to install trac 0.11 on OS X ( 10.4.10)
The following are notes on how to install and configure trac on OS X with multiple projects with a dedicated user to maintain the trac installation. These notes have been derived from several sources and are primarily so I can reproduce this at a later date without thinking, they are, unsurprisingly
You'll need the following
- sudo / root access
- internet access
- python 2.3.5
- sqlite3
You will need to download
- Apache 2.2.4
- Mod_python 3.3.1
-
setuptools
- Install Apache 2.2.4
- Follow Richard's instructions, see step 6 for an overview check there is something sane here http://127.0.0.1/
./configure --prefix=/Users/jono/Applications/apache/2.2.4 --enable-mods-shared=most --enable-ssl --with-mpm=worker --without-berkeley-db --enable-proxy makesudo make installcd ~/apache/2.2.4/binsudo ./apachectrl start
- Install mod_python 3.3.1
- configure and install
./configure --with-apxs=/Users/jono/Applications/apache/2.2.4/bin/apxsmakesudo make install
-
tell apache about it
add
toLoadModule python_module /Users/jono/Applications/apache/2.2.4/modules/mod_python.so
/Users/jono/Applications/apache/2.2.4/conf/httpd.conf
-
test apache is talking to python
- edit
httpd.confadd <Location /mpinfo>
SetHandler mod_python
PythonHandler mod_python.testhandler
</Location>
-
restart apache and see what we get
cd ~/apache/2.2.4/binsudo ./apachectrlhttp://127.0.0.1/mpinfo
you should get a table showing various System information about apache, python and the request headers, including who the process is running as. In our case it is daemon - make a note of this you'll need it later.
-
clean up
remove the following from
<Location /mpinfo>httpd.conf
SetHandler mod_python
PythonHandler mod_python.testhandler
</Location>
- edit
- Install python modules required by the latest version of trac ( 0.11)
- install setuptools
- this will need to be done as root so you have write permissions to
/System/Library/Frameworks/Python.framework/Versions/2.3/bin
sudo python ez_setup.py
-
link it to a bin directory in your path - This should be a single line!
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.3/bin/easy_install easy_install
- test it, type eas and you should get tab completion, well, assuming you are using bash.
- install Genshi
easy_install Genshi
- install pysqlite
- make sure easy_install is going to install the correct version,it should be 2.3.2 or above
easy_install -n pysqlite
- if the above seems okay, install it
easy_install pysqlite
This is some what more convoluted than it needs to be, once edgewall release a complete version (0.11) of trac, this will be
easy_install tracHowever at present this installs 10.4, which is not what we want, so it is worth trying easy_install -n trac to see if it is going to install 0.11, until then, there is :
- check out the latest code from svn, in my case this was revision 6049.
svn co http://svn.edgewall.org/repos/trac/trunk trac
sudo python ./setup.py installsudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.3/bin/ trac-admin trac-adminsudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.3/bin/ tracd tracdsudo nicl / -merge /groups/daemon users daemontrac-admin project00 initenvtrac-admin project01 initenv chown -R :daemon project00 chown -R :daemon project01 chmod -R g+rw project00 chmod -R g+rw project01 Configure apache to talk to trac via mod_python
- add the following to httpd.conf
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /Users/trac
PythonOption TracUriRoot /trac
</Location><LocationMatch "/trac/[^/]+/login">
AuthType Basic
AuthName "Trac"
AuthUserFile /Users/trac/.htpasswd
Require valid-user
</LocationMatch>
- as the trac user populate .htpasswd
htpasswd -c /Users/trac/.htpasswd jono
trac-admin /Users/trac/project00 permission add jono TRAC_ADMINtrac-admin /Users/trac/project01 permission add jono TRAC_ADMINtrac-admin /Users/trac/project00 permission remove anonymous '*'trac-admin /Users/trac/project00 permission remove authenticated '*'trac-admin /Users/trac/project11 permission remove anonymous '*'trac-admin /Users/trac/project11 permission remove authenticated '*' sudo ./apachectl stopsudo ./apachectl start http://127.0.0.1/trac/project0http://127.0.0.1/trac/project1 Locaiton from <Location /trac> to <LocationMatch "/.+/"> remembering to also update the closing Location tag to LocationMatchsudo ./apachectl stopsudo ./apachectl startFinally
Things to do:
- get svn access working
- consider https
- consider using digest rather than basic athenication
- virtual hosts
Links
Observations
- install using the default locations for python, installing with user specific locations will cause a great deal of pain, if you know what you are doing with PYTHONPATH, you will probably be okay, then again, you probably aren't going to be reading this either :)
- if you ignored me and tried installing setuptools without root access you will have noticed the binary failed to install and now you are wondering how to get it installed.
sudo python ez_setup.py -U setuptools
- restarting apache,there are notes on either the trac or mod_python site about this, it would appear that
sudo ./apachectl restartdoesn’t always work, this is usually when you are tired and it has been working all day, save yourself pain just use.
sudo ./apachectl stop
sudo ./apachectl start
-
if trac isn’t playing you may want to make sure it is installed correctly, try the following
- create a dummy project
trac-admin testTrac initenv
- create a dummy project
- start the trac daemon
tracd --port 8000 /Users/jono/Documents/trac/testTrac
- point a browser to
http://localhost:8000/testTrac
- if it all looks okay, you can delete this now