A Working Trac installation on Dreamhost

trac-dhIn this post, I’ll try to describe the steps I had to make to get a working Trac installation on Dreamhost. A few months back, Dreamhost started providing a one-click advanced installation package for trac 0.11.1 . With this package, you can get a working trac installation in a few simple steps. You can even use the Dreamhost panel to upgrade to the latest version, if a new release is made.

Trac is a very powerful package, but installing it (and getting it to work) on Dreamhost hasn’t been easy. Several shell scripts exist that provide a Trac installation, but they all need some manual tinkering.

In theory, the one-click installers at Dreamhost are just that : one click, and you have a ready-to-go setup. In the case of Trac, the installation you obtain by simply using the one-click install is not quite usable nor complete. Ihave tried some time to get a more functional installation, and I’d like to share what I did.

I didn’t do this by myself. The first part of this document is based quite heavily on http://www.vishalkumar.in/2009/09/how-to-set-up-trac-and-subversion-svn-on-dreamhost/

Step 1 : Create a Subversion repository

Trac needs a subversion repository to link to the source code it is managing. Create one in the Goodies > Subversion screen.


Step 2 : Go to the One-click installs, advanced section

Step 3 : Select Trac, and fill in the appropriate values


[ad name=”horiz-banner”]

Fill in the following values:

Install to: The domain you host with Dreamhost where you want your trac installation to appear.
Use SVN Repo: The Subversion repository you just created. It will be in the list once the creation process has been completed. You should receive a mail for that.

Leave the rest as it is.

We now have a Trac installation. When you go to the frontpage, that is what you get. At this point, the link with the source code will be working. You can browse through the source code using the link in the right upper corner if you wish to. The login link does not work however, and one needs to be logged in before the nice bits of Trac become available. Let’s fix that…

Step 4 : Create permissions file

Dreamhost offers the possiblity to create permission files (which are called .htaccess on our Apache webserver platform), but as of today, that functionality has a bug in it, which renders Trac unusable. We will create our .htaccess file ourselves.

Create a textfile, name it .htaccess, and put the following text in it:

<Files *.cgi>
SetHandler fastcgi-script

DirectoryIndex index.fcgi

# Make sure rewrites work
Options ExecCGI FollowSymLinks

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !^index.fcgi/(.*)
# Keep the graphics and style sheet the way they are
RewriteCond $1 !^(.*).css$
RewriteCond $1 !^(.*).gif$
RewriteCond $1 !^(.*).jpg$
RewriteCond $1 !^(.*).png$
RewriteCond $1 !^(.*).js$             <– This is what is needed extra to make Trac work
RewriteRule ^(.*)$ index.fcgi/$1 [L]

### Generated by Dreamhost. DO NOT modify!!! ###
AuthType Basic
AuthUserFile [installation_path].htpasswd
AuthName “Trac”
require valid-user

Substitute [installation_path] with the full path of your trac install dir, as it is known locally on the machine (something like “/home/username/yourdoma.in/”)

Place the file on the server, and rename it to .htaccess. Some ftp programs have difficulties with uploading files preceded by a dot. It’s the UNIX/Linux way of marking a file to be hidden to the user. That’s why renaming is sometimes easier.

login to your Dreamhost account

For the following steps, it is necessary to connect yourself with the shell on your dreamhost server. From there, you can use the command line of the hosting machine as if you were in front of it. We’ll need to execute a few of those commands.

There are several tools to do this, but the most widely used on the Windows platform is PuTtY. Download it here.

When starting it, you will get to a screen like this one:


Setup the trac administrator

Log onto your SSH account at Dreamhost, and perform the following command in the directory of your trac installation:

trac-admin <trac-install-path> permission add <username> TRAC_ADMIN

That gives the user with <username> administrator rights over your trac installation in <trac-install-path>. That user will be created in the next steps.  There is no need to define other users at this stage. The administrator will be able to do that in the web interface.

If you had used the Dreamhost control panel feature to create your .htaccess file, you would have received the following error : “Missing or invalid form token. Do you have cookies enabled?”. The reason is that the URL rewrite rule for Javascript files isn’t available, and as such all javascript will be missing. That means you’ll be unable to do anything.

comment here:

Leave a Reply