Installing Trac 0.11 on MediaTemple (dv) 3.5 servers
You wanted it! So here it is!
A very quick way of getting Trac running on a MediaTemple (dv) 3.5 server through Apache.
YAY YAY YAY YAY
Note: This how-to assumes that you’ve already got an SVN repository running on the server. If you haven’t set one up yet (and want to) then you can find my Subversion & Apache tutorial here
Another requirement is to have Python enabled in Plesk, so if it isn’t already, jump into the site config and check the Python box
We’re going to install it using the new easy_install installer, which take SO much of the guess work out of the process. Gone are the days if compiling all the dependancies.
To get started, we’ll need to install the python easy_install package manager, since it’s not installed by default:
# download the easy setup installer wget http://peak.telecommunity.com/dist/ez_setup.py # run the install through python python ez_setup.py # now install Trac using the easy_install installer easy_install Trac
Can you believe that’s it!? Huge kudos to the code monkeys at Edgewall for that one. Now we move onto the setup. You can essentially install Trac anywhere you like, there’s no right or wrong place. The tutorial installs it just outside your sites web root, so in the domain folder created through Plesk. You can change that to any other place though…
# Change directory to the domain dir cd /var/www/vhosts/ # Setup the trac install in a subfolder # called 'trac' you'll be asked a tonne # of questions about your setup & subversion # details, so be sure to have them all on hand trac-admin ./trac initenv # start the built in server just to test it works tracd --port 8000 /var/www/vhosts//trac
So that’s your Trac install all setup, if you visit http://#domain.com#:8000 you should see the Trac homepage, if you do, then AWESOME, if you don’t, let me know and I’ll try to work out what’s gone wrong. Now we move onto getting Trac to work with Apache through mod_python. We need to tweak some permissions and stuff to get Trac to play nice, but before we do, remember to kill the tracd service by hitting the Ctrl-C combo.
# We need to create this folder & # give it a few too many rights mkdir /.python-eggs chmod a+rw /.python-eggs # The database will require write # access from users other than root chmod -R a+rw /var/www/vhosts//trac/db # There's a bug in the setup of # Trac and Apache, this is a hacky fix cd /usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/tests/functional mv compat.py testcompat.py rm compat.pyc
Now that we’ve laid the ground work, we need to get Apache all setup and working. We’ll start by making sure mod_python is enabled
# look for the LoadModule line # (should be up top) # if it has a hash (#) infront of it remove it vim /etc/httpd/conf.d/python.conf
Now we need to edit the domain’s config
vim /var/www/vhosts//conf/vhost.conf
You’ll want to paste in these attributes, changing the paths when necessary. We’ll also set Trac up to require authentication, it’s the same authentication we created in the previous SVN tutorial. If you don’t want to use authentication in Trac, just remove the last 4 lines.
I’ve also enabled PythonDebug which is handy when fixing issues in Trac, but you can disable it to help secure and optimise.
The following config will set Trac up to be accessed via http://#domain.com#/trac, if that doesn’t suit, change the location and TracUriRoot to whatever you’d like:
SetHandler mod_python PythonDebug on PythonPath "sys.path + ['/var/www/vhosts//trac']" PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/www/vhosts//trac PythonOption TracUriRoot /trac AuthType Basic AuthName "Your Repository" AuthUserFile /var/www/vhosts//repo/.repoUsers Require valid-user
Save off the change and restart Apache
web
And you’re done!
You should be able to access your new, fresh Trac install through http://#domain#/trac
As always, if you have any issues just drop a comment and I’ll try to help you folks out!
Enjoy!