SVN_REPO_PATH=/opt/subversion/data/repositories
SVN_REPO_DESC=Subversion Repositories
SVN_REPO_PATH=/svn
SVN_REPO_INDEXED=true
SVN_DEFAULT_USERNAME=svn
SVN_DEFAULT_PASSWORD=svn
svn_list_parent_path=$( [[ "$SVN_REPO_INDEXED" = "true" ]] && echo on || echo off )
sudo su
apt-get -y update
apt-get -y install apache2 libapache2-svn subversion
mkdir -p $SVN_REPO_PATH
addgroup subversion
usermod -a -G subversion www-data
svnadmin create $SVN_REPO_PATH/svn
chown -R www-data:subversion $SVN_REPO_PATH
chmod -R g+rws $SVN_REPO_PATH
cat <<EOF > /etc/apache2/mods-enabled/dav_svn.conf
<Location $SVN_REPO_PATH>
DAV svn
SVNParentPath $SVN_REPO_PATH
SVNListParentPath $svn_list_parent_path
AuthType Basic
AuthName "$SVN_REPO_DESC"
AuthUserFile /etc/subversion/passwd
Require valid-user
<IfModule mod_authz_svn.c>
AuthzSVNAccessFile /etc/subversion/access
</IfModule>
</Location>
EOF
htpasswd -c -B /etc/subversion/passwd $SVN_DEFAULT_USERNAME $SVN_DEFAULT_PASSWORD
cat << EOF > /etc/subversion/access
[/]
* = r
EOF
service apache2 restart
References