Thursday, March 8, 2012

Configuring svn on Apache

I followed this page to install/configure svn on my server ... it's written for Windows-based Apache install, so I've summarized and transcribed the following platform-anostic (and maybe overly general) steps:

  1. make sure dav_module, dav_svn_module, and authz_svn_module are installed on Apache (assuming you're using webdav to do svn)
  2. create an (arbitrarily named/located) svn config file (maybe called subversion.conf) and include in httpd.conf
  3. create an (arbitrarily named/located) auth file (maybe called svn-auth-file) with the htpasswd binary that comes with Apache (should be under apache/bin), using -cm flag for first user and -m for each additional
  4. create an (arbitrarily named/located) acl file (maybe called svn-acl) and assign permissions to users created in the previous step to groups and "projects" (directories) following this format:

# specify groups here
#
[groups]
team1 = ross, rachel

#
# team1 group has a read/write access to project1 repository
# all subdirectories
# all others have read access only 
#
[project1:/]
@team1 = rw
* = r

#
# project2 repository, only harry and sally have read-write access to project2
#
[project2:/]
harry = rw
sally = rw
* = r


4. inside the subversion.conf create a virtual directory using the following format, including the acl file created in the previous step

<location project1="">
  DAV svn
  SVNPath C:/Repositories/project1

  AuthType Basic
  AuthName "Subversion Project1 repository"
  AuthUserFile c:/etc/svn-auth-file

  Require valid-user

  AuthzSVNAccessFile c:/etc/svn-acl 
 </location>

No comments: