Install Subversion Server on OpenSUSE 12.3

1. Install requirements

zypper install subversion subversion-server apache2 apache2-doc apache2-prefork libapr1 libapr-util1 libneon libneon-devel

2. Create account

groupadd -r svn
useradd -r -g svn -d /home/svn -s /bin/false svn

3. Add Apache2 module

a2enmod dav
a2enmod dav_svn
a2enmod authz_svn

4. Configure Apache

vi /etc/apache2/conf.d/subversion.conf

<IfModule mod_dav_svn.c>
  <Location /svn>
    Order allow,deny
    Allow from all
    DAV svn
    SVNParentPath /home/svn/repos
    SVNListParentPath OnAuthType Basic
    AuthName "Subversion access requires login."
    AuthUserFile /home/svn/users/svn_passwd
    Require valid-user
    AuthzSVNAccessFile /home/svn/users/svn_acl

5. Prepare directories

mkdir -p /home/svn/repos
mkdir -p /home/svn/users
chown root:www /home/svn/repos
chown root:www /home/svn/users
chmod 750 /home/svn/repos
chmod 750 /home/svn/users

6. Add SVN user

touch /home/svn/users/svn_passwd
chown root:www /home/svn/users/svn_passwd
chmod 640 /home/svn/users/svn_passwd
htpasswd2 /home/svn/users/svn_passwd user01

7. Create SVN access list

vi /home/svn/users/svn_acl

admins = root, user01
web-developers = user01, user03
everyone = user01, user02, user03

@admins = rw
user01 = rw
user03 = r
chown root:www /home/svn/users/svn_acl
chmod 640 /home/svn/users/svn_acl

8. Create repogitory

svnadmin create /home/svn/repos/

chown -R wwwrun:www /home/svn/repos/*/{db,locks}
chown wwwrun:www /home/svn/repos/*

9. Apply skin of directory index(3rd-party XSLT)

10. Script for new repogitory (tip)

vi ~/bin/create_repo


if [ -z "$1" ]
  echo "Usage: `basename $0` [repository name]"
  exit 1

svnadmin create /home/svn/repos/$1
chown wwwrun:www /home/svn/repos/$1
chown -R wwwrun:www /home/svn/repos/*/{db,locks}
svn mkdir -m "initial structure" -q http://$svnuser:$svnpass@$1/branches http://$svnuser:$svnpass@$1/tags http://$svnuser:$svnpass@$1/trunk

exit 0


♦ References

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.