Edgewall Software

How to install Trac 0.12 on Ubuntu 11.10 with Apache2 using WSGI

Notice: These instructions are incomplete. See http://robertbasic.com/blog/trac-on-ubuntu for more detailed instructions.

Every time I use vim you can use any editor you want, such as nano or gedit.

Install Trac (and useful plugins) from repository:

sudo apt-get install trac trac-accountmanager trac-graphviz trac-icalviewplugin trac-mastertickets trac-wysiwyg trac-wikitablemacro trac-tags trac-customfieldadmin trac-datefieldplugin

If you're going to use sqlite for database, then install python-sqlite:

sudo apt-get install sqlite3 python-sqlite

Install sendmail (if not installed already):

sudo apt-get install sendmail

Add Trac user:

sudo adduser --system --shell /bin/sh --gecos 'trac project managment' --group --disabled-password --home /var/trac trac

Add www-data to Trac group so Apache can access Trac files

sudo adduser www-data trac

Login as Trac user start bash and swich to homedir:

sudo su trac

Make directory for all projects and create new project

mkdir projects
cd projects
trac-admin android initenv
trac-admin android deploy android/deploy

and finish instalation

Change permissions so group can write/read/execute

chmod 0775 . -R

You can add as many projects as you want. And even later, all you have to do to create a new project, deploy it and you're set.

Back to your user. pressing Ctrl-D twice should get you back.

Now we'll configure Apache.

Open apache apache site file what you want to use for Trac (default should be fine). In my case I have Virtualhost for subdomain Trac.

vim /etc/apache2/sites-enabled/trac

and looks like:

<VirtualHost *>
  ServerName trac.domain.my
  DocumentRoot /var/trac/projects

  WSGIScriptAliasMatch ^/([^/]+) /var/trac/projects/$1/deploy/cgi-bin/trac.wsgi
  <Directory /var/trac/projects>
    WSGIApplicationGroup %{GLOBAL}
    Options Indexes +ExecCGI +SymLinksIfOwnerMatch
    AllowOverride None
    Order allow,deny
    allow from all

  <LocationMatch /[^/]+/login>
   AuthType Basic
   AuthName "trac"
   AuthUserFile /var/trac/.passwd
   Require valid-user

... trac unrelated stuff...


WSGIScriptAlias does all the magic. It gets its project name from url and redirects to trac.wsgi in that project. If you're not running Trac sites as a subdomain but as a folder in your documentroot (i.e. domain.ur/trac/myproject) replace:




(there's just added 'trac/'). And make sure that /var/trac/projects is in DocumentRoot.

Reload apache configuration

sudo service apache2 reload
Last modified 20 months ago Last modified on Dec 20, 2015, 3:32:47 PM
Note: See TracWiki for help on using the wiki.