Install Mercurial WSGI on Scientific Linux 6.5

— door Evert Mouw


Hg logo Programmers, writers and other creative persons use source code version control systems to keep track of changes, histories and milestones of their work. They also use such systems to work together in teams. The Mercurial (Hg) system is especially popular with Python programmers. A good introduction can be fout at Hg Init.

This guide shows how to install a web-based Hg (Mercurial hgweb) repository on your Apache webserver that runs soms version of Enterprise Linux 6, e.g. Red Hat Enterprise Linux (RHEL), CentOS, or Scientific Linux. It will use the fast WSGI method instead of CGI. This guide was tested with Scientific Linux 6.5.

I must attribute much gratitude to an earlier guide written by Josip Medved (Medo) titled Mercurial on CentOS 6.2. You might still want to read that guide too; it is somewhat more verbose.

Furthermore, I have used the fine documentation from Mercurial itself, located at:

Install Mercurial

I assume you already have installed Apache and Python on your server.

Create directories and files

Create directories

Create /srv/hg/cgi-bin/hgweb.wsgi

Create /srv/hg/cgi-bin/hgweb.config

Create a test repository

Apache configuration

I assume you use vhost.d virtual domains. If you don’t, you might consider creating /etc/httpd/conf.d/vhost.conf

Add to /etc/httpd/vhost.d/your-domain-name

Create users and passwords

(You could also use the htpasswd -c option, but be careful — it destoys an existing file, including all earlier created users.)

Set ownership of files and SELinux labels

Restart Apache


It should work now. Test it using your browser.

Remember: When creating new repositories, you must make apache the owner of the files. Also, make sure SELinux labels are right using ls -alZ or repeat the chcon command from above.

If you like Markdown, then you should consider the Markdown Extension for hgweb as well.

Happy hacking!


Facebook Comments