I finally decided to setup an online version control and chose subversion (instead of cvs which I use on my macbook). Initially, I was thinking of subscribing to github but the prospect of paying monthly did not bode well especially that it would only be me who will be updating the codes. Github has a free service though. But that’s if you open-source your code.

Ok, enough for the chatter. Here’s the steps for installing subversion.

Step 1: Install SubVersion via yum
yum install mod_dav_svn subversion

Step 2: Edit Apache Config
vi /etc/httpd/conf/httpd.conf

make sure to uncomment the following lines.
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule dav_module modules/mod_dav.so

Step 3: Restart Apache
service httpd start

Step 4: Edit subversion.conf

cd /etc/httpd/conf.d/
vi subversion.conf

make sure the modules below are also uncommented
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Add the following to allow a basic authentication and point Apache to where the actual repository resides.

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

# Limit write permission to list of valid users.
# Require SSL connection for password protection.
# SSLRequireSSL

AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/svn-auth-conf
Require valid-user

Since I’m using Virtual Private Server (VPS) and suPHP, I have the code below. Take note that the location is inside the VirtualHost directive.

<VirtualHost *:80>
ServerAdmin support@domain.com
DocumentRoot /var/www/domain.com
ServerName domain.com
ServerAlias *.domain.com
suPHP_Engine on
suPHP_UserGroup myuser myuser
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
ErrorLog logs/domain.com-error_log
LogFormat "%h %l %u %t "%r" %>s %b" common
CustomLog logs/domain.com-access_log common
<Location /repos>
DAV svn
SVNParentPath /var/www/domain.com/repos SetHandler repos

AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/svn-auth-conf
Require valid-user


Step 5: Set the Password for your Users

[root@vps ~]# htpasswd -cm /etc/svn-auth-conf yourusername
New password:
Re-type new password:
Adding password for user yourusername
[root@vps ~]# htpasswd -m /etc/svn-auth-conf anotherusername
New password:
Re-type new password:
Adding password for user anotherusername

Step 6: Create Your Repository

[root@vps ~]# cd /var/www/ -- Or wherever you placed your path above
[root@vps ~]# mkdir svn
[root@vps ~]# cd svn
[root@vps ~]# svnadmin create repos
[root@vps ~]# chown -R apache:apache repos
[root@vps ~]# service httpd restart

Source : http://wiki.centos.org/HowTos/Subversion

Comments are closed.

Post Navigation