Trac Moin Python Postgresql Apache Red Hat Enterprise Linux Installation and Dependency Hell
by Alistair Miles
I’ve recently been helping out on a software development project in my department. I decided to try out Trac – a software project management tool – to see if it could help us manage the development process. So I downloaded the latest stable release (0.10.4), and set about installing it on a server. This is what happened next…
First of all, I found out the server had Python version 2.2.3, and Trac needs 2.3 or greater. So I thought I’d upgrade Python to the latest stable release (2.5.1). But when I’d installed the new version of Python, I discovered that the MoinMoin wikis stopped working (three separate instances were running on the server). I had first installed Moin a couple of years ago, so I thought I might as well upgrade Moin too. So I got the latest version of Moin (1.5) and set about installing that. Unfortunately, I didn’t read the upgrade instructions in any detail, and so tried to run the new version of Moin on one of the wikis without upgrading the underlying data. It was then I found out you need to run upgrade scripts to make the data compatible with the software. So I found the migration scripts (all 12 of them) and set about running them on the data. However, because I’d run the wiki with the new software, it had made some changes to the data which fouled up the migration scripts. Fortunately I hadn’t touched the other two wikis, so I managed to migrate the data ok for them, but I couldn’t migrate the first wiki (which ironically had the most data) and I had no way of isolating or reverting the changes because I (foolishly) hadn’t made a backup.
I then found the data/text directory for the wiki, in which the latest version of each wiki page content is stored, so I figured I could simply go through these one by one and manually reinstate the content. But I thought it would take me as long to to it by and as it would to hack up a Python script to do it for me, and the lesson in Python would be a more valuable use of my time. So I wrote a little Python script to do my work for me, which wasn’t too hard, only when I ran the script I activated the surge control on the wiki, because of the repeated edit requests in a short space of time. So then I had to figure out how to turn off the surge control and delete the surge log, to get the script to run. In the end, I got that to work, so the wikis were back. But I still hadn’t got much closer to installing Trac.
With the new version of Python I managed to install Trac, so I set about setting up an environment for my project. Trac can run on Postgresql or SQLlite, and Postgres looked the easier of the two, especially as my Red Hat box already has it installed. But, although postgres was installed, there wasn’t a service configured for it, so I set about finding a startup script. To get this I had to download the entire source distribution, but I got one in the end, and managed to set it up. To run with Postgres, Trac needs a Python adapter, so I got pyPgSQL and tried to install it, but when I did I got a lot of syntax errors, which worried me. I then tried the other alternative – psycopg2 – and got the same result. Eventually I figured out neither of these worked, because pg_config wasn’t installed on the server. Luckily I found something which told me that comes with the postgres development packages, so – up2date to the rescue – I got the rh-postgresql-devel package and installed it, and after that I could install pyPgSQL.
So after all that, I was finally able to set up a project environment successfully. But then to actually interact with it, I needed to set up the Apache web server, for which there are three options. I chose the mod_python option, because it was one of the two recommended options and it looked easier to do, so I got the latest mod_python (3.3.1) and installed it. I then changed the Apache configuration script to load the modules, and checked the configuration syntax before restarting, to get an error that the module couldn’t be loaded because of something to do with a component called “apr”. The long and the short of it is, after much trawling of mailing lists, I got it to work by installing an earlier version of mod_python instead (3.1.4) – it was either that, or upgrade the Apache server from version 2.0.46, which I just couldn’t face at that point.
After finally getting mod_python in, I was excited to send my browser in the direction of my new Trac project – only to get an error concerning something called ClearSilver, which is the HTML templating engine used in Trac (although not for much longer I gather). Apparently, ClearSilver wasn’t installed properly. So I got ClearSilver, and after trying several different versions, found that the latest (0.10.4) would install OK with Python 2.5.1.
And then it all worked.