Thursday, January 15, 2009

Setting up Trac with Plesk

If your running a Plesk server and want to get trac running with mod_python, heres what I did to get them running nicely.

This tutorial assumes you have already installed Subversion, Trac, and that running your Trac daemon was successful.

Setup the trac subdomain in plesk:

1] Create a subdomain 'trac'
2] important: make sure python is unchecked->DISABLED (wierd i know!)

Creating a new project:

#trac-admin /disk1/trac/mynewproject initenv
#mkdir /disk1/trac/mynewproject/.egg-cache
#chmod 777 /disk1/trac/mynewproject/.egg-cache
#chmod -R 777 /disk1/trac/mynewproject/db
#chmod -R 777 /disk1/trac/mynewproject/attachments



Adding a new user:
#htpasswd /disk1/trac/.htpasswd mynewusername


Editing user permissions:
http://trac.edgewall.org/wiki/TracPermissions
If there are no trac admins yet, you must create one in the shell
an example:

#trac-admin /disk1/trac/myproject permission remove anonymous BROWSER_VIEW
#trac-admin /disk1/trac/myproject permission add auser TRAC_ADMIN


Editing trac vhost file:
Please note the PythonPath, your may be different. try typing #find -name trac to find the folder thats similar to mine.

#emacs /var/www/vhosts/yourdomain.com/subdomains/trac/conf/vhost.conf for the new location
example:

<location "/mynewproject">
# SetHandler mod_python
SetHandler python-program
# PythonDebug on
PythonPath "['/usr/lib/python2.4/site-packages/'] + sys.path"
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /disk1/trac/mynewproject
PythonOption TracUriRoot /mynewproject
</location>
<location "/mynewproject/login">
AuthType Basic
AuthName "WillInteractive Trac Server"
AuthUserFile /disk1/trac/.htpasswd
Require valid-user
</location>


Restart your apache server
#service httpd restart

Next try to access it in your browser at:
http://yourdomain.com/mynewproject


1 comment:

hysteriskt said...

it didn't work, until i enabled back python in my subdomain. I had to comment the following lines in your vhost.conf file
# SetHandler python-program
# PythonDebug on
# PythonPath "['/usr/lib/python2.4/site-packages/'] + sys.path"

I'm running Plesk 8