[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Subversion HowTo

This is a simple how to set up your own subversion (SVN) repository on Slackware. When I wanted to set this up myself I found a document on how to set it up on a much older Slackware version so I created this to document on a more current version (14.2 as of this writing).

Repository folder

Subversion and its tools are installed by default in Slackware so you simply need a place to store the repository.

Start by creating a folder for the SVN repositories:

mkdir -p /home/svn/repositories 

Apache Config

Now we need to setup Apache

Edit /etc/httpd/httpd.conf

And uncomment the following three lines:

LoadModule dav_module lib64/httpd/modules/mod_dav.so
LoadModule dav_svn_module lib64/httpd/modules/mod_dav_svn.so
LoadModule authz_svn_module lib64/httpd/modules/mod_authz_svn.so

Now add a virtual host for the repository location to the Apache config:

 <Location /svn>
    DAV svn
    SVNParentPath /home/svn/repositories
    AuthzSVNAccessFile /home/svn/.svn-policy-file
    AuthName "Test SVN Repo"
    AuthType Basic
    AuthUserFile /home/svn/.svn-auth-file
    Satisfy Any
    Require valid-user
 </Location>

This sets up a simple path based authentication.

SVN authentication and Users

Now setup the svn root directory by creating /home/svn/.svn-policy-file:

Here the * gives read to all users and I gave myself (enine) read write access to a repository called test

 [/]
 * = r
 
 [test:/]
 enine = rw

Next we create the .svn-auth-file first user and the first user.

htpasswd -cs /home/svn/.svn-auth-file enine

-c tells htpasswd to create the file and -s uses sha1 for storing the password to add additional users simply remove the c option.

note that sha1 is not the most secure, you may wish to use htdigest or configure SSL in Apache to prevent password sniffing.

Now create a repository

svnadmin create --fs-type fsfs /home/svn/repositories/test

–fs-type fsfs creats the file-system based repoistory

And give Apache permissions over it

chown -R apache:apache /home/svn/repositories/test

If you didn't have Apache already running enable it

chmod +x /etc/rc.d/rc.httpd

And start Apache

/etc/rc.d/rc.httpd start

Now you can do a quick test

http://<server>/svn/test/

Sources

 howtos:network_services:subversion ()