Subversion is the Version Control System of choice for most people in the environment I work in (Computing Science students and systems administrators). A good source of documentation is the Red Bean Book. Subversion is easily installed by apt-get install subversion.
Procedure 45. Creating a SVN repository
Create the repository on the server:
svnadmin create /var/lib/svn/grid
Import the layout of the repository:
svn import template/
file:///var/lib/svn/grid
-m "initial import"
Adding template/workernode
Adding template/workernode/trunk
Adding template/workernode/branches
Adding template/workernode/tags
Adding template/iserv
Adding template/iserv/trunk
Adding template/iserv/branches
Adding template/iserv/tags
Adding template/master
Adding template/master/trunk
Adding template/master/branches
Adding template/master/tags
Committed revision 1.
Procedure 46. Creating a Subversion server using Apache(version 2)
Create a separate system group 'svn': addgroup --system --group svn
Change ownership of created repositories:
chgrp -R svn:svn /var/lib/svn/
Add the apache user to the 'svn' group
[22]
:
adduser www-data
svn
Add some more users to the 'svn' group:
adduser username
svn
[23]
Install mod_dav by apt-get install libapache2-svn.
Edit /etc/apache2/mods-available/svn.conf
to contain
<Location /svn> DAV svn # any "/svn/foo" URL will map to a repository /usr/local/svn/foo SVNParentPath /var/lib/svn AuthType Basic AuthName "Subversion repository on myhost.com" AuthUserFile /etc/subversion/passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> Order deny,allow Deny from all # Localhost Allow from 127.0.0.1 Allow from 192.168.5.0/24 </Location>
Enable the configuration: cd /etc/apache2/mods-enabled && ln -s ../mods-available/svn.conf ./.
And reload the Apache configuration: /etc/init.d/apache reload
Create a new passwd file for Apache and put a username/passwd in it.
htpasswd -cs /etc/subversion/passwd
username
Procedure 47. Using the Apache SVN server
Check out
[24]
an (empty) working copy with cd /
&& svn co http://myserver.com/svn/repository/project/trunk/
./
Add files to subversion control using svn add /etc
Commit it like this: svn commit -m"Adding /etc"
Procedure 48. Enabling ssh access to the Subversion repository
Nothing needs to be done. Just link /svn to /var/lib/svn for convenience and use it saying svn co svn+ssh://myhost.com/svn/repository/project/trunk ./
[22] We are assuming here that Apache is already installed
[23] I think membership of this group is only important if it is required by Apache asking for it in a 'require' statement. When a user logs in via the web server, all writing of the repositories is done by the web server. But is it nice anyway in case a user wants to do file-based access instead of via the web server.
[24] I tried to use the svn import command to do the initial fill of the project, but it failed giving a 405 (resource not allowed) error on the PROPFIND request in the Apache logs. The checkout and commit works fine so I won't spend time on it.