A tutorial for getting a local installation of Trac running quickly
February 22, 2019•323 words
I decided to give Trac a try on localhost, just to see if it's worth installing on a Digital Ocean droplet. I found the instructions to be imperfect in places - being an intermediate user of web technologies, I figured it out, but many others would give up.
The first step was to install. I'm running Ubuntu 16.04, so that's easy:
sudo easy_install Trac
No problems. The documentation then said to create a project environment. I created ~/trac and used a modified version of their command:
trac-admin ~/trac initenv
No problems. The next step is to start the standalone server:
tracd -s --port 8000 ~/trac
It starts up to some plain html. That's okay. I click one of the links and I get the expected Trac website. Unfortunately that's where the easy part ended.
I tried to edit the wiki, but there was no edit button. Guess I have to log in. But I didn't create a user. After some searching around I finally realized that you have to create a .htpasswd file somewhere on your computer as you would when using Apache for authentication even if you're not using Apache.
I created a .htpasswd file inside ~/trac (fine for localhost only usage, which really doesn't even have a need for a password).
sudo htpasswd -c ~/trac/.htpasswd alice
and entered a password. That created a .htpasswd file inside ~/trac with a user named Alice. This is basic authentication, so I had to start my server with the appropriate information:
tracd -s --hostname=localhost --port=8000 --basic-auth="trac,trac/.htpasswd,myproject" ~/trac
The part inside quotes contains relative paths (not clear from the documentation) and requires the --basic-auth option. Now it all works. I can dig in and see how useful it is. I may even put it on a server and make use of it on a permanent basis. Hopefully this proves useful to at least one other user.