At this stage we now have a fully functioning Mercurial server but we have not created any repositories yet. A repository is where you sync your source code to, you need one for each application/NSF that you’ll be building. We could create them manually using the ‘hg init’ command but if you have a lot of projects then this can become a tedious process of having to log into the server every time somebody needs a new repository. Instead I’m going to install phpHGAdmin. It’s a PHP based management system for Mercurial. This step in the process is a little complex but once it’s complete you’ll find managing the system will be a lot easier.
First off we need to download the phpHGAdmin software. The command below will download the version current at the time of writing this entry but if it dosen’t work then you can find the latest version on https://bitbucket.org/joshjcarrier/phphgadmin/downloads and substitute the newer url in the command.
Once it has downloaded we can unzip it using the unzip command. The unzip command if not installed by default on Ubuntu Server so before we can unzip the software we’ll need to install unzip.
sudo unzip phphgadmin-1.1.20100623.zip -d /var/www
The files have been unzipped into the /var/www folder and now we need to make Apache aware of the new folder and setup a couple of special Apache settings. Lets edit the /etc/apache2/sites-available/default file again and add in some special directives for phphgadmin.
sudo vi /etc/apache2/sites-available/default
and add the following lines below the section just above the ScriptAlias line, replace the ‘username’ in the ‘require user username’ line with the username of the person you want to have administrative rights to the system.
allow from all
AuthName “Mercurial Server”
require user username
AuthLDAPURL “ldap://yourserver.com:389/O=YourOrg?CN?sub?(objectClass=*)” NONE
Save the file once you are done. Before we restart Apache we need to enable the rewrite module. Here’s the command to turn that module on and then restart Apache.
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
At this stage Apache knows about the PHGHGAdmin application but if you go to http://yourserver/admin you will get an error message as we still have to configure the application. I’ll show you how to do this in the next part.