Setting up SVN with HTTP Access On Centos 5

Published:
Updated:
INTRODUCTION

Subversion is a fantastic version management and software configuration management tool for teams and individuals to manage software applications. It offers many advantages over it's CVS ancestor such as it's built-in compatibility with Apache through the WebDAV protocol giving easy remote access over HTTP.

(Your server will require an external IP address to be accessed from an external location)

This tutorial will take you step-by-step through the install and set-up process for Subversion.


SETTING UP YUM

The easiest way to install and manage packages on Linux is using yum. It can detect dependencies and resolve them for you - easing many headaches! If you do not have it installed then you can quickly install it from the terminal.

Run the following commands to install it (hit y where necessary to confirm the process):

rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
                      
                      rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.19-18.el5.centos.noarch.rpm http://mirror.centos.org/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

Open in new window


Yum should now be ready to use!

INSTALLING SUBVERSION

1. From the terminal run the following commands (hit y where necessary to confirm the process):

yum install subversion
                      yum install mod_dav_svn

Open in new window


mod_dav_svn allows integration with Apache through the WebDAV protocol.

You may find that SVN is already installed by default.

Enter svnadmin into the terminal to confirm correct installation.

SETTING UP SUBVERSION

1. First you must create a directory for your svn repository. Through this tutorial my repository will be in the  / directory and called repos. You should change the paths throughout the tutorial if you want to place the repository in a different place.

To create your repository and assign permissions open the terminal and run the following commands:
mkdir /repos
                      svnadmin create /repos
                      chown -R apache.apache /repos
                      chmod g+s /repos/db

Open in new window


2. Within /etc/httpd/conf.d you will find a file called subversion.conf. This file configures SVN to work with Apache. You must edit it to specify your SVN repository and secure it.

First copy and paste the file renaming it to subversion-backup.conf. This is just incase you make any mistakes - you can restore the file to its original with little hassle.

Then delete the contents of the original file. Add in the following to the file, changing directories where necessary to your own repository.

<Location /repos>
                           DAV svn
                           SVNPath /repos
                      
                           AuthType Basic
                           AuthName "Your Subversion Repository"
                           AuthUserFile /etc/httpd/passwd/password
                           Require valid-user
                      
                      </Location>

Open in new window


This is all the changes you need to make to Apache. You have now told Apache where your SVN repository is and told it to authenticate the user. The last thing we need to do is create the username and password for the user

3. From your terminal enter the following commands to set the SVN username and password.

mkdir /etc/httpd/passwd
                      htpasswd -b -c /etc/httpd/passwd/password svn_username svn_password

Open in new window


Whichever username and password you choose - it will be required to authenticate when you attempt to connect to the SVN repository over HTTP.

You should note that your password is stored in plain-text and sent over the web in plain text unless you use SSL. This is outside the scope of this article.


Thats all there is to setting up SVN. Restart Apache to make all your changes take effect.

To test your setup open a web browser and navigate to http://externalip/repos

It should return:

Revision 0: /
Powered by Subversion version 1.0.4 (r9844).


You can now use various clients such as Eclipse (with a plug-in) to add to your repositories.

2
5,147 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.