Thursday, June 3, 2010

CONFIGURING SVN SERVER IN UBUNTU

Subversion is an open source version control system. Using Subversion, you can record the history of source files and documents. It manages files and directories over time. A tree of files is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to files and directories
Lets see the configuration of Subversion repository in Ubuntu 9.10 server edition OS.
Install the following pre-requisites packages:
apt-get install apache2 subversion libapache2-svn
You can create SVN repository with the following command
svnadmin create /svn.linux.com
Create a dir from where you want to add/import contents to the repository
mkdir /importloc
mkdir /import/loc/test1
Import Contents to the repository
svn import /importloc/test1 file:///svn.linux.com/test1 -m "test1 repo"
Configuring users’ access level can be done with authz in the following location
cd /svn.linux.com/conf
vim authz
[groups]
admin=linux
##Here admin is a group; linux is a user.
[/]
@admin=rw
## Here, rw -> Groups will have read and write permission
r -> read only permission
‘’ -> no permission
:wq
Generate a password for the user ‘linux’
htpasswd -mc /svn.linux.com/conf/passwd linux
Subversion can be configured to be accessed through WebDAV protocol via Apache webserver
Configuration of WebDAV access for Subversion is as follows
Create a soft link with the default webpage of the system
cd /etc/apache2/sites-available
ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/svn.linux.com
cd /etc/apache2/sites-enabled
Before editing svn.linux.com file, delete all the contents of it and populate it with the following confs
vim svn.linux.com
# ServerName svn.linux.com
DAV svn
AuthType Basic
AuthName "svn.linux.com"
AuthUserFile /svn.linux.com/conf/passwd
AuthzSVNAccessFile /svn.linux.com/conf/authz
SVNPath /svn.linux.com
Require valid-user
## For Enabling Logging
CustomLog /var/log/apache2/svn.linux.com/access.log combined
ErrorLog /var/log/apache2/svn.linux.com/error.log
#SSLEngine on
#SSLCertificateFile /etc/apache2/ssl/apache.pem
For enabling Subversion Logging
cd /var/log
mkdir svn.linux.com
cd svn.linux.com
touch access.log error.log
/etc/init.d/apache2 restart


Once done all this, open internet Explorer in client machine and type http://svn.linux.com

You will be prompted for credentials, passing through which you should be able to access the repository.
SVN Client software for committing/updating to/from the SVN repository in Windows machine is Tortoise SVN client software. This software can be downloaded from http://tortoisesvn.net/downloads
Accessing the SVN repository from linux clients will be updated in my next post.

No comments:

Post a Comment