How to setup a Ubuntu development server - Part 2
Also read Part 1 - Subversion.
In this part I will tell you how to install Trac on top of your Subversion repositories on your Ubuntu development server. Trac offers you a wiki, roadmap, tickets (tracking system) and access to your SubVersion repository. All of this is bundeled in a very sexy web interface.
Well, let’s get to work now and get Trac installed. When you’re done you will have trac available for all your Subversion repositories. ~
First thing to do is install trac. Here I will also install mod_python for your apache webserver and python-setuptools that we’ll need later with the webadmin plugin.
$ sudo apt-get install trac libapache2-mod-python python-setuptools
Now, I create a directory where all Trac information will be stored.
$ sudo mkdir -p /var/lib/trac
Common sense dictates that you use the same name here for the trac environment as for the subversion repository.
Change to the trac directory and intitialize the project:
$ cd /var/lib/trac $ sudo trac-admin colt initenv
You’ll need to name the project, choose a database file (default is okay), specify where the subversion repository resides ( /var/lib/svn/colt, in this case) and a template (the default is okay here too).
I recommend you also create an administrator user right now. Make sure you add a user who’s already in your /etc/apache2/dav_svn.passwd file.
$ sudo trac-admin colt permission add ariejan TRAC_ADMIN
Well, that’s it. Trac has been installed. Now let’s make sure we can access trac through the web.
Configuring apache is rather easy when you know what to do. Add the following code to /etc/apache2/sites-available/default (at the bottom before the end of the virtualhost tag) or put it in a seperate virtual host file if you want to dedicate a special domain to this.
<location /projects> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnvParentDir /var/lib/trac PythonOption TracUriRoot /projects </location> <locationmatch "/projects/[^/]+/login"> AuthType Basic AuthName "Trac Authentication" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user </locationmatch>
Notice here, again that we use TracEnvParentDir to show we host multiple instances of Trac. You may change the TracUriRoot to something different.
Again, make sure to chown your Trac installation to www-data:
$ sudo chown -R www-data.www-data /var/lib/trac
You may also login now! As you can see, we use the dav_svn.passwd file here so everyone with subversion access also has access to trac.
Normally you would administrate a Trac installation through the command-line interface we used to initialize the environment and add the administrator user. Nowadays there is a webadmin plugin for Trac, which will be included in Trac from version 0.11. Since Ubuntu ships with Trac 0.9.3 we need to add this webadmin ourselves.
First, download the following file to your server: http://trac.edgewall.org/attachment/wiki/WebAdmin/TracWebAdmin-0.1.2dev_r4240-py2.4.egg.zip.
Don’t unzip this file, just remove the .zip extension.
Because we installed setuptools earlier, we can now use easy_install to install this plugin system-wide, enabling it for all our trac installations.
$ sudo easy_install TracWebAdmin-0.1.2dev_r4240-py2.4.egg
Next we enable webadmin in the global configuration file of track. You may need to create the ‘conf’ directory in this case:
$ cd /usr/share/trac $ sudo mkdir conf $ sudo vi conf/trac.ini[/conf]
Next enter the following in trac.ini
[components] webadmin.* = enabled
Save the file and off you go. Login as the administrator user you specified earlier and you can make use of the ‘admin’ button that has appeared in the menu of Trac.
Enjoy your trac! Next time (in Part 3) I will talk about setting up a commit-hook so Trac tickets are updated by posting subversion commit messages (throught commit-hooks).
Also read Part 1 - Subversion on how to install Subversion over WebDAV.
Hey! I'm a software engineer building rock solid back-end systems using Ruby, Ruby on Rails and Golang. In my free time I like to repair audio equipment, play the piano and experiment with electronics.