Scope

This post will give you a brief introduction to installing SVN and using it. Just a working knowledge, which is all anyone can ask for right?

Installing a SVN server

On my network I have an old box that does a lot of services (dns, dhcp, samba etc). Since day to day I may be in different locations, I want this box to be the master repository for my code because of the easy access via ssh I have to it. I also want to install the web interface to svn so I can browse my code etc which I find easier to navigate then the svn interface itself.

The first thing we will do is install packages:

  • sharms@huron:~$ sudo apt-get install subversion subversion-tools subversion-helper-scripts websvn enscript libapache2-svn

This will automatically install svn (subversion), apache, php4 and the svn web interface. The “enscript” entry is to highlight source code through websvn which I find nice. During this install, on dapper, when prompted I selected the following:

  • Exim: local delivery only
  • Websvn: yes – configure websvn now
  • Apache2: select atleast apache2 on configuration screen

Creating a repository

Once the above steps were done, I needed to actually create the repository. I have chosen the default location of /var/lib/svn, which if you just hit enter on the install it will assume that path. To create a repository:

  • sharms@huron:~$ sudo svnadmin create /var/lib/svn

And if you browse to http://yoursvnserver/websvn — there is your svn repository. To enable code highlighting, edit /etc/websvn/config.inc and uncomment the line:

  • $config->useEnscript();

To enable your svn repository to be accessed / modified through http:

  • Edit /etc/apache2/mods-available/dav_svn.conf
  • Uncomment “DAV svn”
  • Uncomment and modify “SVNPath” to read “SVNPath /var/lib/svn”
  • Uncomment AuthType, AuthName, and AuthUserFile lines
  • Run “htpasswd2 -c /etc/apache2/dav_svn.passwd sharms” where sharms is your username
  • Restart apache

Actually using svn

To actually use SVN, I find the SVN cheat sheet useful.  Here is one command where I add a directory to svn:

  • svn import testproject http://192.168.1.2/svn -m “Import to central svn server”

Related posts:

  1. Using Apache to decrypt SSL pages
  2. Cool development environment
  3. Daily life with Ubuntu
  4. Fun with Amazon S3 in Ubuntu Hardy
  5. Installing VMWare tools