Subversion setup

From Smith family

Jump to: navigation, search
Server setup
← Previous Next →
Scanner Git

Subversion is a version-control repository. This is a fairly standard setup, except that I have a few repositories to maintain security when several people have access.

  • Install the required packages:
root@server:~# apt-get install subversion subversion-tools libapache2-svn
  • Create the subversion group and add Apache as a member of it:
root@server:~# addgroup subversion
root@server:~# adduser user1 subversion
root@server:~# adduser www-data subversion
where user1 is a user who needs access to the Subversion repository.
  • Create the directories for the repositories:
root@server:~# mkdir -p /opt/svn/repo1
root@server:~# mkdir -p /opt/svn/repo2
  • Set permissions
root@server:~# chown -R www-data:subversion /opt/svn/repo1/
root@server:~# chown -R www-data:subversion /opt/svn/repo2/
root@server:~# chmod g+rws /opt/svn/repo1/
root@server:~# chmod g+rws /opt/svn/repo2/
  • Create the repositories
root@server:~# svnadmin create /opt/svn/repo1/
root@server:~# svnadmin create /opt/svn/repo2/
  • Reset the permissions, to allow http:// access to the repositories
root@server:~# chmod g+rws /opt/svn/repo1/
root@server:~# chmod g+rws /opt/svn/repo2/
  • Modify the Apache2 config file for the host that will provide access to the repositories. Note that this needs to be a host that isn't running Mediawiki with the path rewriting.
<Location /svn>
    DAV svn
    SVNParentPath /opt/svn/
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd
    Require valid-user
 </Location>
This ensures that only authenticated users have read access to the repositories.
  • Add users to the password file. For the first user, use the -c switch:
root@server:~# htpasswd -c /etc/apache2/dav_svn.passwd user_name
and give the password when prompted. For subsequent users, omit the -c switch to avoid overwriting the exisitng password file.
  • Restart Apache
root@server:~# /etc/init.d/apache2 restart

You should now be able to browse to http://svnsite.domain.tld/svn/repo1 and view the repository.


See also

Here are a few pages that are useful guides or provide background and context.

Personal tools