Dreamhost Trac One-click Installs: the Stupidity and the Solution

I use Dreamhost to host this site. It’s pretty cheap and for a web admin noob like me, it makes things simple. I have no idea what an Apache is, or any of that crap. I just.. put things here. And they appear.

One of the things Dreamhost has is a way to easily install some common software packages, such as Trac. I’ve used Trac for years over on Dsource and I’ve grown to like it. So I was happy to find out I could host my projects/wikis on my own site.

Well there’s a problem: the default one-click Trac install is .. messed up.

So when you do a Trac install on Dreamhost, it creates two directories: one in your home directory that contains the actual Trac source and CGI files, and another in the domain directory of your choice that holds the configuration, database, files etc. etc. etc. There’s a problem, though. It installs the source for Trac 0.11.4, but when you actually look at the newly-created page, you’ll notice this:

Trac's welcome page says 0.11.4, but the page was generated by 0.11.1.

Notice that the welcome page says it’s 0.11.4, just like the source. But the page was generated by 0.11.1.

Why does this happen? Because despite installing the 0.11.4 source to your home directory, there is an installation of 0.11.1 in /usr/lib that it uses instead.


I can’t fathom why this is. Why does this matter? Because when I tried to set up the Account Manager Trac plugin, I started getting strange errors like this: http://trac.edgewall.org/ticket/8684 Namely, when I logged in, I’d get a stack trace with the error “‘Environment’ object has no attribute ‘secure_cookies’.” This is caused when you try to use Account Manager with a version of Trac before 0.11.2, since secure_cookies was added in that release.

Okay, so how do you fix this? It’s actually not that hard. All you have to do is build/install 0.11.4 in your home directory, and modify your PYTHONPATH to point to it. Here’s what I did.

First, in your home directory, create a directory chain ~/lib/python2.5/site-packages. This is going to be where you install 0.11.4 to.

Second, change to ~/domain_com_tracname_trac (won’t be called that, it’ll use your domain name and the name of the Trac install you gave). This is the directory with the 0.11.4 source in it, and also where the cgi-bin directory resides (in which are the entry points for the CGI server). First open up setup.cfg in vim or something, and add the following:


install_dir = /home/yourusername/lib/python2.5/site-packages

Save and exit. Now run “./setup.py build” followed by “./setup.py install”. It should install to that directory.

Okay, now you have 0.11.4 installed to the right place. Now you have to make Python see it. Change into your domain where you installed Trac (for me, it’s ~/jfbillingsley.com/tracname). There should be an index.fcgi file there, if you used FCGI during the install. Open it. Right after the “export TRAC_ENV” line, you’re going to add another export, for PYTHONPATH this time.

export PYTHONPATH=”/home/yourusername/lib/python2.5/site-packages”

Save and exit. One more thing before we try this out: there are some commandline tools like trac-admin which were installed by setup.py as well, but your PATH is still pointing to the server-wide 0.11.1 ones. So open up ~/.bash_profile and add this export:

export PATH=${HOME}/lib/python2.5/site-packages:$PATH

And then do a “source ~/.bash_profile”. A “which trac-admin” should now point to the one in your home directory.

Last, but not least, see if there’s already an FCGI process running for your Trac site. Do a “ps aux” and look for a “/usr/bin/python ..blahblah.. /cgi-bin/trac.fcgi”. Do a “kill -9 <thatprocess>”.

Now load up your Trac site. It should now say 0.11.4 at the bottom. Yaaaaay! And now Account Manager works, yaaaaaay!