Recently, I've found a need to keep track of a lot of documents and configs of devices. I've also had a need to version control some of my documents and code.

I've decided to use SVN with WebSVN to view all the configs and documents. To commit I will be using RapidSVN

Under Gentoo when you install SVN server it automatically sets the repository location at "/var/svn" If you want this to be on a separate volume, you'll need to set up a mount point before the install.

SVN has two DB options :-

  • FSFS
  • Berkeley DB

I want to use FSFS, so add the "-berkdb" use flag to your /etc/make.conf You can find the benefits/weakness of each hear.

I also want to build SVN with Apache, for the SVN DAV. So make sure /etc/make.conf contains the apache2 use flag To install :

# emerge --config =dev-vcs/subversion-1.6.11
# emerge -a mod_python

After the install fix the permissions, as they may be broken.

# groupadd svnusers
# chown -R root:svnusers /var/svn/repos
# chmod -Rf go-rwx /var/svn/conf
# chmod -Rf g-w,o-rwx /var/svn/repos
# chmod -Rf g+rw /var/svn/repos/db
# chmod -Rf g+rw /var/svn/repos/locks</em>

Start the server :

# /etc/init.d/svnserve start

Lets get apache configured to support SVN

# nano /etc/conf.d/apache2
find the line "APACHE2_OPTS="
Add in "-D DAV -D SVN -D PYTHON -D PHP"

start apache

# /etc/init.d/apache2 start

Install WebSVN Add use flags "enscript" to /etc/make.conf and emege the package :

# emerge -av websvn

Create a repository :

# svnadmin create --fs-type fsfs /var/svn/REPOSITORYNAME

Edit Apache default vhost

# nano /etc/apache2/vhosts.d/00_default_vhost.conf

This will expose all repositories. Add the following:-

<Location /svn>
DAV svn
SVNParentPath /var/svn
</Location>

Note the above config is very insecure, by default all can read/write and all clients can connect with out auth. For me this is by design as my SVN host is fire-walled off from everything but internal LAN clients.

Edit websvn :

# nano  /var/www/localhost/htdocs/websvn/include/config.php

Since I want to expose all my repositories I need to  uncomment and change the following line to set my SVN path :

$config->parentPath('/var/svn');

Also edit and uncomment  the following line to enable enscript

$config->setEnscriptPath('/usr/bin/');