Trac on Ubuntu
These instructions were tested with a fresh install of 8.04, and installs Trac 0.11.
Also see TracInstallPlatforms, TracInstall, TracOnUbuntu, Ubuntu-Trac, hardy, cgi.
Installation
1. Install Software Packages
To install Trac on your system, install apache, setuptools and some libraries:
sudo apt-get install apache2 libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion sudo easy_install Trac
2. Create the Trac Environments Directory
You'll need a directory for Trac's environments to live that should be writable by the default Apache user:
sudo mkdir /var/lib/trac sudo chown www-data:www-data /var/lib/trac
3. Setup Apache2
Next, create a new Apache-2 virtualhost, and paste the text below into the file:
sudo vi /etc/apache2/sites-available/trac
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName trac.example.com
DocumentRoot /var/www
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined
<Location /projects>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /projects
PythonOption PYTHON_EGG_CACHE /tmp
</Location>
# use the following for one authorization for all projects (names containing "-" are not detected):
<LocationMatch "/projects/[[:alnum:]]+/login">
AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</LocationMatch>
</VirtualHost>
Now, disable the default virtualhost, enable the Trac virtualhost, and restart Apache2:
sudo a2dissite default sudo a2ensite trac sudo /etc/init.d/apache2 reload
4. Creating Environments
I installed my Subversion repository at /var/lib/svn/YourProjectNameHere. So I did a quick starting config of subversion with the following commands:
sudo mkdir /var/lib/svn sudo svnadmin create /var/lib/svn/YourProjectNameHere
Some permissions changes and an apache restart are now needed:
sudo chown -R www-data /var/lib/svn sudo chown -R www-data /usr/share/trac sudo /etc/init.d/apache2 reload
I put my trac environment at /var/lib/trac/YourProjectNameHere. Of course you could use any other path or name - something a little more descriptive of your project would probably be a good idea. First I ran these commands:
sudo mkdir /var/lib/trac sudo trac-admin /var/lib/trac/YourProjectNameHere initenv sudo chown -R www-data /var/lib/trac
The "trac-admin" command shown above prompted me to enter:
- the project name (YourProjectNameHere)
- the path to svn repository (/var/lib/svn/YourProjectNameHere)
... then it prints out a bunch of stuff. If there are no errors you should now be able to surf to your Trac site at http://servername/projects
For more complex mod_python configs, see TracModPython
make subversion running as well
You will also need to uncomment the settings in /etc/apache2/mods-available/dav_svn.conf
<Location /svn>
# Uncomment this to enable the repository,
DAV svn
# Set this to the path to your repository
SVNParentPath /var/lib/svn
</Location>
add some plugins to have a usable system
sudo apt-get install build-essential graphviz sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/ sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11 sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10 sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11 sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11 sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/ sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11 sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11 sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11 sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
what one should probably do different than described here
sudo chown www-data /etc/apache2/dav_svn.passwd


