Warning: This worked for me on Trac 0.11.1 hosted at Dreamhost as of March 2010 but I take no responsibilities. Use this information at your own risk.
Trac is a very popular open source system to manage software development projects, but it can also be very useful for other management tasks. Installing Trac on Dreamhost is very, very easy, thanks to the available one-click install feature. However, a fresh installation of Trac is useless because, to begin with, you can’t log in to administer Trac. You need to browse the Internet for a while to figure out how to overcome this and other small inconveniences. While not very difficult, it can be time consuming and you might forget how you did it the previous time, as it happened to me.
Appart from that, you might be initially stuck at how to configure directories for different projects and their corresponding subversion repositories. There are lots of possibilities to set up all this stuff and mine might not be the best approach, but it has worked pretty well for me.
Here is what I did, just in case it comes in handy to you:
Directories, Trac and Subversion
1 – Set up a new subdomain for all your Trac projects, for example myprojects.yourdomain.info, using Dreamhost’s control panel.
2 – Create a new subversion repository that matches your project name (for example newproject) at myprojects.yourdomain.info/svn/newproject using Dreamhost’s control panel.
As a general rule, don’t create subversion repositories inside Trac projects or directories containing another application. Use a new directory or a new subdomain for all your subversion repositories. For example, don’t install your subversion repository at myprojects.yourdomain.info/newproject/svn if you plan to install Trac at myprojects.yourdomain.info/newproject. Everything seems to work until you try to commit a change.
3 – Install Trac on myprojects.yourdomain.info/newproject using the one-click advanced install from the control panel and link it to the subversion repository created in the previous step: myprojects.yourdomain.info/svn/newproject.
Trac is now installed, but you can’t log in. You need to authenticate. The easiest way is via HTTP basic authentication, which is not recommended. HTTP digest authentication is preferred (step 4).
Trac Authentication and WebAdmin
4 – Connect to your Dreamhost account using SSH and use htdigest to create a file for digest authentication, for example at /home/youraccount/trac.htpasswd:
htdigest -c trac.htpasswd whatever yournewuser
The actual name of the realm (“whatever”, in this case) is not important but it’s mandatory, as it will be used in the next step to check credentials.
5 – Add the following to myprojects.yourdomain.info/newproject/.htaccess:
AuthType Digest
AuthName "whatever"
AuthUserFile /home/youraccount/trac.htpasswd
Require valid-user
Note that realm (“whatever”, including quotes) must match what you provided to htdigest in the previous step.
Refresh your browser and check that your Trac site asks you for a username and password. You are now logged in Trac using HTTP digest authentication.
You’ll probably want to use WebAdmin to manage Trac, so proceed to step 6.
6 – Still connected via SSH? From your Dreamhost acount use trac-admin to add permissions (and check them afterwards) to yournewuser:
trac-admin /home/youraccount/myprojects.yourdomain.info/newproject
Welcome to trac-admin 0.11.1
Interactive Trac administration console.
Copyright (c) 2003-2008 Edgewall Software
Type: '?' or 'help' for help on commands.
Trac [/home/youraccount/myprojects.yourdomain.info/newproject]> permission add yournewuser TRAC_ADMIN
Trac [/home/youraccount/myprojects.yourdomain.info/newproject]> permission list yournewuser
Refresh your browser. Now a new tab called “Admin” should appear next to the Wiki, Timeline… Search tabs on the top right corner of the page.
You’re done!
Thanks to all people that have shared their previous experience installing Trac on Dreamhost. I found this post by Arash Keshmirian particularly useful.
Tagged Dreamhost, Trac, Tutorial