Knowledgebase: Third-Party Software
Set Up WebSVN
Posted by H9 Admin on 21 January 2015 12:21 PM

If you want to set up a Subversion repository and allow public browsing, use WebSVN. Trac, another similar option, 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. The Subversion Book has some nice suggestions for this sort of thing.

  3. Create a temporary directory and then import it, like so (be sure to replace <username> with your HostNine 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 www/websvn --username guest
Authentication realm: <> 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/ include/
$ vim include/

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 HostNine username.

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

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
Help Desk Software by Kayako fusion