Tuesday, July 5, 2011

Configured SVN with http & https

yum install mod_dav_svn.i386


After installation we'll have to ensure that mod_dav_svn module was properly installed on apache.

LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so

We have apache with mod_dav_svn module installed properly. At this point we can create a repository. This will help us to test our instalation:

root# mkdir /var/www/svn
root# mkdir /var/www/svn/repos
root# svnadmin create /usr/home/svn/repos/test

Then we have to create the files that are going to be used to authenticate the users.

root# mkdir /var/www/svn/access
root# cd /var/www/svn/access
root# htpasswd -cm users root
password:****
root# htpasswd -m users viewer
password:*****

For add new user htpasswd -m users username

root# vi control

[test:/] repo name
root = rw
viewer = r
[test:/trunk] permission for trunk only
santosh = rw

[voip:/] repo name
arun = rw
ajay = r
santosh = rw



Now we will configure apache to read the repositories:

root# vi /etc/httpd/conf.d/subversion.conf


DAV svn
SVNParentPath /var/www/svn/repos
# SVNIndexXSLT "http://venus.idhasoft.com/svnindex.xsl"
AuthzSVNAccessFile /var/www/svn/access/control

# # Limit write permission to list of valid users.
#
# # Require SSL connection for password protection.
SSLRequireSSL
#
Satisfy Any
AuthType Basic
AuthName "Subversion Repositories at venus.idhasoft.com"
AuthUserFile /var/www/svn/access/users
Require valid-user
#



Apache will read all the files that are under the Includes directory, so our svn.conf will be loaded when apache starts, note that we are loading svnindex.xsl that is the file where the transformations are done, if you would like to give to your repository some look and feel work these file will be the appropiate. The file skeletons are under /usr/local/share/subversion/xslt/ directory, there are two files, one .xsl and another .css. Copy these files to your document root. I have a virtual server called svn.example.com in my machine. I have all my virtual servers under /usr/local/www/pages, so I have svn.example.com directory and I've configured that virtual server in /usr/local/etc/apache2/httpd.conf.

NameVirtualHost *:80

ServerAdmin ecruz@example.com
ServerName svn.example.com
DocumentRoot /usr/local/www/pages/svn.example.com
CustomLog /var/log/svn.example.com-access_log common


Restart the web server:

/etc/init.d/httpd restart

0 comments:

Post a Comment