Version 8 (modified by 12 years ago) ( diff ) | ,
---|
How to install Trac 0.12 on ubuntu 11.10 machine with apache2 using wsgi. (everytime I use vim you can user 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 usermod -aG trac www-data
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 WSGIScriptAlias ^/([^/]+) /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