Subversion Network Setup

This was originally posted on my family blog on 4/20/06. I will be slowly moving the geeky stuff from there to this blog.

In a previous entry I explained how I set up subversion on my linux box. At the end I left a reminder to myself to write down how to set up network access to the repositories before I forgot. Well, I forgot, and now that I'm migrating everything over to Ubuntu 5.10, it's time to re-learn. Here's my notes on how to do it.

I will again be using the subversion book. Specifically chapter 6. I also got help this time around from a blog entry about setting up subversion with apache on Ubuntu.

Alright, under Prerequisites in the svn book it lists what you need to install. These are all easily obtainable through apt (since I'm on Ubuntu):

aptitude install libapache2-svn

(I already had apache2 and subversion installed. I'm assuming the above would have grabbed those too though, if they weren't already installed, because apt is cool like that).

The above will install the modules needed for apache2 and add all the needed LoadModule commands. It also creates a configuration file in /etc/apache2/mods_benabled/dav_svn.conf. I commented out everything that was in this since I want my subversion repository served by one of my virtual hosts. Wherever you put it, you need something like this:

<Location /repos>
    DAV svn
    SVNPath /path/to/svnrepository

    # how to authenticate a user
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /path/to/svnrepository/svn-auth-file
    Require valid-user
</Location>

Then do:

/etc/init.d/apache2 reload

Now you need to setup the http authentication password file. The book explains it well:

$ ### First time: use -c to create the file
$ ### Use -m to use MD5 encryption of the password, which is more secure
$ htpasswd -cm /path/to/svn-auth-file harry
New password: ***** 
Re-type new password: *****
Adding password for user harry
$ htpasswd -m /path/to/svn-auth-file sally
New password: *******
Re-type new password: *******
Adding password for user sally

At this point you should be able to browse the svn repository, after entering your username and password, by pointing your web browser to http://www.example.com/repos/project/ (assuming your hostname is www.example.com, of course). You should also be able to checkout code, like so:

svn co http://www.example.com/repos/project/trunk/ project

That's it!

Comments

Popular posts from this blog

SystemVerilog Fork Disable "Gotchas"

'git revert' Is Not Equivalent To 'svn revert'

Git Rebase Explained