Knowledge Base

Set Up WebSVN

If you want to set up a Subversion repository and allow public browsing, use WebSVN. As dicussed elsewhere, Trac has too many dependencies (including 'mod_python' or 'fcgi', which can be a pain) and WebDAV is out of the question for shared accounts, so an alternative is needed.

WebSVN offers a few different clean interfaces and a nice set of options. Here's how you set everything up:

  1. Create a svn repository (we want to specify the FSFS type because the Berkley DB causes to many permission issues when apache runs as a different user than you):

    $ cd ~/
    $ mkdir svn
    $ svnadmin create --fs-type fsfs svn

  2. Lay out our repo into a nice format

    You can create a separate repo for each project, which WebSVN supports, but in a small shared hosting account we want to keep the used disk space to a minimum. Therefore a single, carefully laid-out repo should serve just fine.

  3. Create a temporary directory and then import it, like so (be sure to replace <username> with your ASO username):

    $ mkdir tmpdir
    $ cd tmpdir
    $ mkdir ProjectA
    $ mkdir ProjectA/trunk
    $ mkdir ProjectA/branches
    $ mkdir ProjectA/tags
    $ mkdir ProjectB
    $ mkdir ProjectB/trunk
    $ mkdir ProjectB/branches
    $ mkdir ProjectB/tags
    $ svn import . file:///home/<username>/svn -m 'Inital repository layout'
    Adding       ProjectB
    Adding       ProjectB/trunk
    Adding       ProjectB/branches
    Adding       ProjectB/tags
    Adding       ProjectA
    Adding       ProjectA/trunk
    Adding       ProjectA/branches
    ​Adding       ProjectA/tags

    Committed revision 1.

  4. Now, let's make sure it worked. Delete the temp dir:

    $ svnlook tree /home/<username>/svn
    $ cd ../
    $ rm -r tmpdir

Now we want to install WebSVN. You may not want to use truck; use a stable tag. You must use the username and password (both 'guest').

$ svn co http://websvn.tigris.org/svn/websvn/trunk www/websvn --username guest
Authentication realm: <http://wedsvn.tigris.org:80> CollabNet SCM Repository
Password for 'guest': guest
A  www/websvn/licence.txt
U www/websvn
Checked out revision 445.

Finally, we point WebSVN at our repo and alter any other settings we want:

$ cd www/websvn
$ cp include/distconfig.inc include/config.inc
$ vim include/config.inc

Uncomment and edit this line:

$config->addRepository("My Projects", "file:///home/<username>/svn");

Note: If you are not using trunk, you may need to drop the "file://" above (which leaves you with "/home/<username>/svn"). The "file://" proctol appears to be a new feaure only in trunk.

That should do it. Don't forget to replace <username> with your ASO username.

You can see my slightly modified (and currently empty) repo here. Both the config.inc file and install.txt file included with the package have very good documentation on the options available to you.

Did you find this article helpful?

* Your feedback is too short