Trac + SVN Installation on Mac OS X Server 10.4.7
Requirements
Mac OS X Server 10.4.7 + XCode 2.3; download.
Trac | 0.9.6 |
Python | 2.3.5 (as installed with OS X 10.4.7) |
Apache | 2.0.58 |
mod_python | 3.2.8 |
Swig | 1.3.29 |
Subversion | 1.3.2 |
SQLite | 3.1.3 (as installed with OS X 10.4.7) |
PySQLite | 2.2.2 |
Clearsilver | 0.10.3 |
Docutils | 0.4 |
Preliminaries
Install Mac OS X Server 10.4.7 and XCode 2.3.
Download all binaries and untar it for example in the folder /usr/local/temp
.
Binairies Installation
Note: The order of installation is important.
Swig
cd <swig-distribution-top-dir> ./configure --with-python=/usr/bin/python make sudo make install
Apache2
cd <apache2-distribution-top-dir> ./configure --enable-mods-shared=most --enable-ssl --with-mpm=worker --without-berkeley-db –-enable-so make sudo make install
mod_python
cd <mod_python-distribution-top-dir> ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/python make sudo make install
Subversion
cd <subversion-distribution-top-dir> ./configure -prefix=/usr/local --without-berkeley-db --enable-swig-bindings=python \ --with-swig=/usr/local/bin/swig PYTHON2=/System/Library/Frameworks/Python.framework/Versions/2.3/ \ --mandir=/usr/local/share/man --with-ssl --with-apxs=/usr/local/apache2/bin/apxs --with-zlib \ --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 make sudo make install
Swig svn python bindings:
cd <subversion-distribution-top-dir> make swig-py sudo make install-swig-py echo /usr/local/lib/svn-python > /Library/Python/2.3/site-packages/svn-python.pth
PySQLite
cd <pysqlite-distribution-top-dir> sudo python setup.py install
Clearsilver
Note: ClearSilver has been replaced by the Genshi templating engine as of Trac 0.11.
cd <clearsilver-distribution-top-dir> ./configure --prefix=/usr/local --with-python=/usr/bin/python --disable-ruby make # >>> here modify first line of scripts/document.py to use same python (#!/usr/bin/ python) sudo make install
Docutils
cd <docutils-distribution-top-dir> sudo python setup.py install
Trac + SVN Configuration
First choose a location for your subversion repository, eg /var/svn/your_project
, and one for you Trac environment, eg /var/trac/your_project
.
You may need to manage access rights on theTtrac env directory tree. This may be done by first creating a UNIX group dedicated to this trac project, eg trac
, and assigning the various users to this group. The apache www
user should be one of these. If you need a nice description of how to do this, look at Apple CVSOverview, then search for the text "create a new group" or "NetInfo Manager".
In my configuration Apache2 is the nobody
user, so you can try:
sudo chgrp -R www /var/trac sudo chmod -R 770 /var/trac sudo chgrp -R www /var/svn sudo chmod -R 770 /var/svn
SVN Repository
svnadmin create /var/svn/your_project
Subversion executables are installed into /usr/local/bin, which is not in the default path in Mac OS X Server v10.4. To add /usr/local/bin to a user's default path, create a .profile
file in your home directory or simply add the line if you already have a .profile
file:
cd ~ echo 'export PATH="$PATH:/usr/local/bin"' >> .profile
To make sure the repository works fine, try for example the following:
cd /tmp mkdir proj cd proj mkdir trunk branches tags cd .. svn import proj file:///var/svn/your_project -m "Import First" rm -r proj svn co file:///var/svn/your_project proj cd proj svn update
Trac Environment
trac-admin /var/trac/your_project initenv
Your trac-admin
binary may not be in your search path if trac-admin
isn't found, try:
cd ~ echo 'export PATH="$PATH:/System/Library/Frameworks/Python.framework/Versions/Current/bin/trac*"' >> .profile
Apache2 Configuration and Right Access
Apache httpd.conf
Open and edit httpd.conf
in /usr/local/apache2/conf
.
Add this module (if not already existent) at line ~265:
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so LoadModule python_module modules/mod_python.so
Change the process user of Apache (nobody
becomes www
) at line ~300:
User www
Add and configure access to Trac and SVN path at line ~1040:
<Location /your_project/> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac/your_project </Location> <Location "/your_project/login"> AuthType Basic AuthName "emersion" AuthUserFile /var/trac/your_project/.htpasswd Require valid-user </Location> <Location /your_project/svn> DAV svn SVNPath /var/svn/eMersion AuthzSVNAccessFile /var/svn/your_project/conf/authz AuthType Basic AuthName "Reférentiel Subversion" AuthUserFile /var/trac/your_project/.htpasswd Require valid-user </Location>
Trac and SVN .htpasswd
Trac and SVN can share the same .htpasswd
, but you can separate it if you want.
Create the .htpasswd
in /var/trac/your_project/
, for example:
[users] YourName:8d2yxeC7vAkiQ HisName:7$4k2Ci4QoVFc
[users]
is important for the AuthzSVNAccessFile.
To generate a password, you can use this web site.
SVN authz
Edit the file authz
in /var/svn/your_project/conf/
, for example:
[groups] admin = YourName [/] @admin = rw HisName = r * =
For more details on this configuration's file please read this.
Start Apache2
Now you can start Apache2:
sudo /usr/local/apache2/bin/apachectl start
You can check if everything is working well:
- for Trac http://localhost:80/your_project
- for SVN direct access http://localhost:80/your_project/svn
For external access please make your own apache's configuration.
Author
thibaud.guillaume-gentil at epfl.ch