Edgewall Software

How to install Trac 0.12 on ubuntu 11.10 machine with apache2 using wsgi. (everytime I use vim you can use any editor you want (nano, gedit..))

Install trac (and usefull 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 db (as I do) 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
bash
cd

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 create 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
  </Directory>

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

... trac unrelated stuff...

</VirtualHost>

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

^/([^/]+)

line with

^/trac/([^/]+)

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

reload apache configuration

sudo service apache2 reload

You should be done

(Comment: These instructions are relatively incomplete. I found http://robertbasic.com/blog/trac-on-ubuntu to offer more detailed instructions)

Last modified 10 months ago Last modified on Sep 18, 2013 6:28:24 AM