Saturday, May 30, 2009

Subversion - Setting up Apache and Users

Overview
Subversion is a fantastic source control system. Not only is it pretty easy to setup and use but it also integrates with a vast list of IDEs.

This post describes how to setup the base environment for Subversion. This consists of:
  • Apache Configuration
  • Apache Web Server User
Other posts will cover adding repos.

My environment:
  • Internal access only
  • linux/Unix environment
  • Apache + Subversion
Configuring Apache With Subversion
When you install Subversion, there will be a default subversion.conf file setup (most likely) in /etc/httpd/conf.d/ for Apache

Within the environment I use, the following file system structure is used:
  • /opt/intranet/svn - Main area for subversion repos. Local file system.
  • /repos - Apache reference to Parent Path
  • /opt/intranet/svn/users.passwd - Location of subversion user/password file for any/all repos.
What to modify in your /etc/httpd/conf.d/subversion.conf to get it to work like the one described below.

# START OF CONFIG
<Location /repos>
DAV svn
SVNParentPath /opt/intranet/svn

# Limit write permission to list of valid users.
<LimitExcept GET PROPFIND OPTIONS REPORT>
# Require SSL connection for password protection.

SSLRequireSSL
AuthType Basic
AuthName "StoKen Software Subversion"
AuthUserFile /opt/intranet/svn/users.passwd
Require valid-user
</LimitExcept>
</Location>

# END OF CONFIG

Adding a Subversion User
# htpasswd -c /opt/intranet/svn/users.passwd thawk
New password: mypassword
Re-type new password: mypassword
Adding password for user thawk

Final Thoughts
With this step complete, subversion is ready but will not do anything interesting until you add some repos. But that is another post...

No comments: