====== Subversion ======
This document shows how to setup a subversion server on a Debian based system.
Required packages: ''subversion apache2 libapache2-svn''\\
Required: [[apache|Apache with SSL]]
[[https://help.ubuntu.com/community/Subversion|Ubuntu Howto]]
===== Create repositories =====
==== Separate repos ====
mkdir /home/svn
svnadmin create /home/svn/first_repo
svnadmin create /home/svn/second_repo
''/etc/apache2/mods-available/dav_svn.conf''
DAV svn
SVNParentPath /home/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repositories"
AuthUserFile /etc/subversion/passwd
Require valid-user
Disable anonymous access by removing the two ''LimitExcept'' lines
==== Single repo ====
mkdir /home/svn
svnadmin create /home/svn/the_repository
''/etc/apache2/mods-available/dav_svn.conf''
DAV svn
SVNPath /home/svn/the_repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
Require valid-user
Disable anonymous access by removing the two ''LimitExcept'' lines
==== Set permissions ====
addgroup subversion
adduser www-data subversion
chown -R www-data:subversion /home/svn
chmod -R g+rws /home/svn
===== Path-Based Authorization =====
[[http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.serverconfig.pathbasedauthz|Svnbook]]\\
:!: ''mod_authz_svn'' can slow down everything!
''/etc/subversion/dav_svn.authz''
# give everybody read access
[/]
* = r
# give harry full read and write access to this repository, but sally only read access
[first_repo:/]
harry = rw
sally = r
# give sally write access only to the 'testing' subdir
[first_repo:/testing]
sally = rw
''/etc/apache2/mods-available/dav_svn.conf''
AuthzSVNAccessFile /etc/subversion/dav_svn.authz
===== WebSVN repository browser =====
[[http://www.websvn.info|Homepage]]
:!: HTTPS recommended!
''includes/config.php'':
==== Multiple repos ====
$config->parentPath('/home/svn');
==== Single repo ====
$config->addRepository('repository', 'file:///home/svn/the_repository');
===== Backup & Restore =====
Creating a backup of an entire repository while preserving the version history is not a complicated task. There are two different ways: either directly with svnadmin or with the rsvndump tool. The first one can only be done by someone who can access the server via SSH, whereas rsvndump can be used by anybody.
==== svnadmin ====
svnadmin dump /path/to/repository > repo.svn_dump
==== rsvndump ====
[[http://rsvndump.sourceforge.net|rsvndump]]
rsvndump https://the.url.com/svn/repository > repo.svn_dump
==== Restore ====
svnadmin create /path/to/repository
svnadmin load /path/to/repository < repo.svn_dump
Don't forget to set permissions!