How to Configuring Apache for Mercurial
Accessing Mercurial Repositories via
Apache
has a couple of advantages:
• No setup is required for an extra port for external access.
• No SSH key setup is required.
This page describes how to setup
Apache
to serve Mercurial repositories.
| Codebeamer must be installed and started before this configuration can be used. |
Windows
| Select the 32 bit version of all software mentioned below even if you are running 64 bits Windows. |
We strongly recommended using the same versions shown on this page.
This description assumes that Codebeamer has been installed into.
C:\Dokumente und Einstellungen\zk\Eigene Dateien\CB
• Download Apache 2.2.17 from the location below or from a mirror:
http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist//httpd/binaries/win32/httpd-2.2.17-win32-x86-no_ssl.msi
• Install Apache to the default location (C:\Programme\Apache Software Foundation) and take Typical Installation.
• Download Python from the location below http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi .
• Install Python intoC:\Programme\Python-2.6.6.
• Download the Mercurial runtime from the location below. Note that this will not install a complete Mercurial client.
http://mercurial.selenic.com/release/windows/mercurial-1.7.1.win32-py2.6.exe
• Install Mercurial into the same location where Python is installed (C:\Programme\Python-2.6.6).
• Download Apache mod_wsgi module from the location below:
http://modwsgi.googlecode.com/files/mod_wsgi-win32-ap22py26-3.3.so
• Copy mod_wsgi-win32-ap22py26-3.3 so into Apache modules directory
copy mod_wsgi-win32-ap22py26-3.3.so "C:\Programme\Apache Software Foundation\Apache2.2\modules\mod_wsgi.so"
The name of the output file must be mod_wsgi.so.
• Edit the Apache Configuration.
Click > > > > .
Append the lines of C:\Dokumente und Einstellungen\zk\Eigene Dateien\CB\repository\scmweb\httpd.conf.hg to the end of Apache httpd.conf.
The variable WSGIPythonPath must contain the Python installation directory.
WSGIPythonPath "C:/Programme/Python-2.6.6"
• Test Apache Configuration.
Click > > > >
• Restart Apache.
Click > > > > >
Linux/Unix
| It is important that Codebeamer operating system user and apache belong to the same GID! |
Ubuntu
Codebeamer requires Mercurial 1.8.5 (or newer).
This description assumes that Codebeamer has been installed into /home/Codebeamer/CB.
• Install Apache HTTP Server using the following command:
sudo apt-get install apache2
• Install Mercurial using the command below
sudo apt-get install mercurial
| On Ubuntu releases older than 12.04, you have to manually find and install a newer supported version, e.g: sudo add-apt-repository ppa:mercurial-ppa/releases sudo apt-get update sudo apt-get install mercurial hg --version
|
• Install themod_wsgi apache module:
sudo apt-get install libapache2-mod-wsgi
and execute this command
sudo ln -s /etc/apache2/mods-available/wsgi.load /etc/apache2/mods-enabled/wsgi.load
• Copy httpd.conf.hg
sudo cp /home/codebeamer/CB/repository/scmweb/httpd.conf.hg /etc/apache2/mods-available/hg.conf
• Edit/etc/apache2/mods-available/hg.conf and replacePYTHON_PATH with the path to the library containing the Python libraries. For example:
WSGIPythonPath /usr/lib/pymodules/python2.6
• Enable hg support
sudo ln -s /etc/apache2/mods-available/hg.conf /etc/apache2/mods-enabled/hg.conf
After these steps test the apache configuration with the following command:
sudo apache2ctl configtest
If the command runs without errors then the configuration's OK. You can restart apache:
sudo /etc/init.d/apache2 restart
RedHat
Codebeamer requires Mercurial 1.8.5 (or newer).
This description assumes that Codebeamer has been installed into
/home/codebeamer/CB.
• Install the required software components using the following command:
sudo yum install httpd python mercurial mod_wsgi
This will install Apache HTTP Server, Python, Mercurial and the mod_wsgi module. Caution: All RedHat releases (at least until RHEL 6.2) contain an obsolete Mercurial version.
hg --version
In this case, you have to manually find and install a newer supported version, e.g. from
• Copy the file/home/codebeamer/CB/repository/scmweb/httpd.conf.hg to/etc/httpd/conf.d/hg.conf
• Now edit/etc/httpd/conf.d/hg.conf and replace PYTHON_HOME with the path to the library containing the Python libraries. For example:
WSGIPythonPath /usr/lib64/python2.6:/usr/lib/python2.6
• Finally test your configuration:
sudo apachectl configtest
and if everything's fine restart Apache
sudo /etc/init.d/httpd restart