January 12, 2013

How to Install and Configure Subversion (SVN) on RHEL 6.3

In this blog I will show you how to install and configure Subversion (svn) on Red Hat Enterprise Linux (RHEL) 6.3.

1. Installation

First lets install subversion and apache web server, if you already have installed a apache web server, then leave out the httpd package below.

$ yum install subversion httpd mod_dav_svn

2. Configuration

2.1 Create a new Subversion Repository

Now lets create a new subversion repository named 'demorepo'.

$ Create a new Apache directory
sudo mkdir -p /var/www/svn/demorepo

$ Create a new Subversion repository
svnadmin create /var/www/svn/demorepo

$ Change owner of apache svn 
chown -R apache:apache /var/www/svn/demorepo

2.2 Authentication

It is highly recommended to have some authentication to your subversion repository. Here I will use simple login using the built in Apache Web Server module mod_auth_basic. The module is per default installed and configured with the RHEL httpd package, we only need to add new users.

$ htpasswd -c /etc/httpd/conf/passwords magkar

2.3 Configure Apache Web Server

Finally we need to configure the apache web server, for our new web location, but also to apply our authentication. We will facilitate the pre-configured configuration file /etc/httpd/conf.d/subversion.conf that comes with the mod_dav_svn package.

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn

   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /etc/httpd/conf/passwords 
      Require valid-user
   </LimitExcept>
</Location>

Now we only need to restart our apache web server and test our demo subversion repository - http://localhost/svn/demorepo/.

$ service httpd restart

Reference

No comments: