Edgewall Software

Version 7 (modified by rupert.thurner@…, 16 years ago) ( diff )

Trac on Ubuntu

These instructions were tested with a fresh install of 8.04, and installs trac-0.11-rc1.

Also see TracOnUbuntu, Ubuntu-Trac.

Installation

1. Install Software Packages

To install Trac on your system, install the trac, libapache2-mod-python, libapache2-svn, and python-setuptools packages:

sudo apt-get install apache2 libapache2-mod-python libapache2-svn python-setuptools
sudo easy_install Trac==0.11rc1

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
        </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 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 apache2 -k restart

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/

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>
    # 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 mkdir /var/www/.python-eggs
sudo chown www-data /var/www/.python-eggs

sudo apt-get install build-essential
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 
Note: See TracWiki for help on using the wiki.