apache repository setup

John Evans johnevans123 at hotmail.com
Thu Aug 11 17:46:24 CDT 2005


Here is my final setup, not sure if some of the steps are really needed.  
i.e. using "umask" in thes"hg" replacement script might not be needed, but 
this setup is working now for me.   I know that the permissions setting of 
the repository files was needed.  appreciate the assistance from Matt, 
Andrew, Bryan, Thilbalt, as most of this info is merely cutting and pasting 
from their email replies.  formatting of the content here is not great, but 
the info is there, and hope it helps the next person.  Mercurial is really 
nice!

This info outlines the steps for creating a simple Mercurial repository 
using an Apache Webserver.

1. Install linux with apache webserver and follow the instructions give at 
this link:
http://www.serpentine.com/mercurial/index.cgi?ServerInstall

Notes:
      You must use python 2.4 even though the documentation indicates that 
v2.3 is ok.
      Our example server name is “je_server1” throughout the document.
      ssh must be enabled and the sshd daemon functional.

2. Install hg  version 0.6b or higher
http://www.selenic.com/mercurial/release/mercurial-0.6b.tar

3. Create a new group for the repository users, in this case the new group 
is “hggroup”:
      Add a line to /etc/group and include all the current users required:
	hggroup:x:<newgroupID>:olduser1,olduser2,…

      Then change the group ownership of the repo:
	$ chgrp -R hggroup je-repo

      Then change the permissions so that the group can read and write:
	$ chmod -R g+rw je-repo

      Then use setgid to make all new files owned by the group:
     	$ find je-repo -type d | xargs chmod g+s

4. create the users for the repository that have not already been created
            $ adduser –G hggroup –m newuser

      Check /etc/group to make sure that the new group (hggroup) has all the 
required new
      users in the group information.
      In our example we create a “je” user that will hold the repository
            $ adduser –G hggroup –m je

5. Clone the required repository into the target destination
our example will use /home/je/je-repo as the cloned repository

          $ hg clone http://src-repo-server/src-repo /home/je/je-repo

6. Make sure that you can access via ssh (je_server1)
      $ ssh je at je_server1 "ls /home/je/je-repo/.hg"
      $ ssh je at je_server1 "hg -R /home/je/je-repo verify"

7. Create a link in each user’s home directory pointing to the repository
$ cd /home/user1;ln –s /home/je/je-repo je-repo

        Notes: this step is optional depending upon the repo directory and 
“hg push”
        command lines that you allow the user to execute.

8. Create an “hg” script on the server replacing the original “hg” 
executable
      change directory to the location of the current “hg” command
	Then cp hg to another name to add to the script
		$ cp –a hg hg-0.6b
	create a new “hg” file that consists of the following lines
		#!/bin/sh
		umask 002
		/usr/bin/hg-0.6b
                change permission on the new “hg” script
	                 $ chmod g+s hg

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the Mercurial mailing list