Setting up a Secure Subversion Server with Apache in Ubuntu

21 Nov 2009

by hemanth

If you have not read the Apache HTTPS, read it before you go through this post.

"Subversion (SVN) is a version control system initiated in 1999 by CollabNet Inc. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly-compatible successor to the widely used Concurrent Versions System (CVS)." -Wikipedia

Steps are pretty easy now:

Step 1:
Get subversion and Subversion modules for Apache2
sudo apt-get install subversion subversion-tools libapache2-svn

Step 2:
Creating repository and setting permissions

sudo mkdir /var/svn
sudo svnadmin create /var/svn/test
sudo chown -R www-data:www-data /var/svn/test
sudo chmod -R g+ws /var/svn/test

P.S: test is the name of the repo

Step 3:
Configure Apache to detect the svn
edit /etc/apache2/mods-available/dav_svn.conf
See the sample file that is attached

Step 4:
use -c option for the first users
sudo htpasswd -c /etc/subversion/test.passwd hemanth
sudo htpasswd /etc/subversion/test.passwd ubuntu

Step 5:
Reload Apache
sudo /etc/init.d/apache2 reload

Now check your https://localhost/svn it must say revision 0

Checking out and adding files to svn
svn co https://localhost/svn/test test --username hemanth
It will prompt you for your password before checkout
cd test $ echo 'Hello, g33k' > hello.txt
svn add hello.txt
svn commit -m "Added my first file"

That's it, now you can refresh you page to see the new file.
Now download this book:svnbook(click)

Share this