It’s time to start up your Ubuntu server again and log in using the credentials that you were using in the last part of the series. Once your up and running we are going to setup the Mercurial WSGI script so that Apache will be able to use it later. We’ll start by copying the basic script file to the right location.
sudo cp hg-stable/contrib/hgweb.wsgi /var/hg
Next we will edit that file to tell it where to find it’s configuration files. I like to use vi as a text editor on linux but it is not the easiest to use. If you prefer you can use pico instead by typing ‘pico’ in place of ‘vi’ in all the commands from this point forward.
sudo vi /var/hg/hgweb.wsgi
In this file look fo the line that starts with ‘config =’ and change it as follows.
config = “/var/hg/hgweb.config”
Once you have made the changes and saved the file we need to tell Linux that this is an executable script using the command
sudo chmod u+x /var/hg/hgweb.wsgi
That’s the script ready to go but it’s currently pointing to a file that doesn’t exist so lets create it now using
and add these lines to the file…
baseurl = /hg
changegroup.mod_wsgi = touch /var/hg/hgweb.wsgi
Save the file and exit your text editor. We created the file in our working directory so now we need to move it to the /var/hg directory so that the script can find it. We will use a small variation n the sudo command so that it is created with the correct rights for Apache to be able to access it.
sudo -u www-data cp hgweb.config /var/hg
In the next step we will point Apache to these new files and get our Mercurial server up and running with no authentication. In the mean time…
sudo shutdown -h now