Using Subversion for Collaborative Development
Updated: 07/14/2005
General Information
Subversion (SVN) is an alternative to using Concurrent Version System (CVS) for collaborative development, though it has other uses if you develop on more than one machine and wish to keep all your work in a central location. This guide will show you how to setup Subversion with Webaccess via the Apache2 mod_dav svn module. If you already use apache 1.3 you can continue to use that, just change the port that apache2 listens on in its httpd.conf file.Requirements
Installation
We have to start out by building apache2. Because we are building it with the intention of using Subversion with it, we must build it with Berkeley DB (sleepycat) support, as the Subversion filesystem is actually built as a sleepycat database. It is this that allows for the versioning of files.|
# # |
cd /usr/ports/www/apache2 make install WITH_BERKELEYDB=db42 |
|
# # # |
ldconfig -m /usr/local/lib/apache2/ echo "/usr/local/lib/apache2" >> /etc/ld.so.conf echo "/usr/local/lib/apache2" >> /etc/ld-elf.so.conf |
| # | echo 'apache2_enable="YES"' >> /etc/rc.conf |
|
# # |
cd /usr/ports/devel/subversion make install -DWITH_MOD_DAV_SVN |
Configuration
OK, subversion and apache with berkeley db support are now compiled and installed. You have a choice of either creating a single huge repository for all of your projects, or individual repositories for each. I will detail each now.General Setup
Create Subversion Home folder| # | mkdir -p /usr/home/svn |
|
# # # |
mkdir -p /usr/home/svn/default/trunk mkdir /usr/home/svn/default/branches mkdir /usr/home/svn/default/tags |
| # | cp /usr/ports/devel/subversion/work/subversion-1.0.6/tools/xslt/* /usr/local/www/data-dist/ |
Note: The path to the tools/xslt will change with versions of subversion so change the <em>subversion-1.0.6</em> to whatever it is for your version of subversion, ie subversion-1.0.7 or subversion-1.0.8 and so on.
Setup Blanket Access: If you wish to enable htaccess style password login to the subversion repository then use this system. This is the basic access control system, which can be extended to enable per directory access control as well.|
# # |
mkdir /usr/home/svn/access touch /usr/home/svn/access/users |
| # | htpasswd -mb /usr/home/svn/access/users <em>username</em> <em>password</em> |
| # | nano -w /usr/local/etc/apache2/httpd.conf |
|
## SVN WebDAV Repository Setup <Location /svn> DAV svn SVNParentPath /usr/home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # anonymous first Satisfy Any Require valid-user # authenticating them valid ones AuthType Basic AuthName "Subversion Repositories" AuthUserFile /usr/home/svn/access/users </Location> |
| # | touch /usr/home/svn/access/control |
|
[/] admin = rw manager = r [/bigproject] manager = rw commiter = r [/bigproject/trunk] commiter = rw client = r [/bigproject/branches] client = r [/bigproject/trunk/manager_notes] client = commiter = |
|
[bigproject:/] admin = rw manager = rw commiter = r [bigproject:/trunk] commiter = rw client = r [bigproject:/branches] client = r [bigproject:/trunk/manager_notes] client = commiter = |
|
# If we are using the Per-Directory Access Control then we leave this uncommented # Access Control AuthzSVNAccessFile /usr/home/svn/access/control |
|
## SVN WebDAV Repository Setup <Location /svn> DAV svn SVNParentPath /usr/home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # If we are using the Per-Directory Access Control then we leave this uncommented # Access Control AuthzSVNAccessFile /usr/home/svn/access/control # anonymous first Satisfy Any Require valid-user # authenticating them valid ones AuthType Basic AuthName "Subversion Repositories" AuthUserFile /usr/home/svn/access/users </Location> |
Building a Single General Repository
Create our single main repository|
# # |
svnadmin create /usr/home/svn/repos svn import /usr/home/svn/default file:///usr/home/svn/repos -m "initial import" |
Building a Multiple Project Repository
Make a new repository|
# # # |
mkdir /usr/home/svn/repos svnadmin create /usr/home/svn/repos/<em>projectname</em> svn import /usr/home/svn/default file:///usr/home/svn/repos/<em>projectname</em> -m "Initial Import" |
Final Setup
Make sure that apache can read the svn repositories| # | chown -R www:www /usr/home/svn |
|
# # |
chmod 600 /usr/home/svn/access/control chmod 600 /usr/home/svn/access/users |
| # | svn checkout http://www.mydomain.com/svn/<em>projectname</em>/trunk <em>projectname</em> |
| # | svn commit -m "Notes regarding the changes" |
| # | svn update |
|
# # |
cd /usr/ports/devel/subversion make install clean |
Author: Geffy
w00t at stealth-ninja dot co dot uk