Wednesday, 19 December 2012

Install SVN Server on CentOS

Install SVN

Install mod_dav_svn right away which is required to make SVN work with Apache.
$ yum install mod_dav_svn subversion

Create a repository
$ svnadmin create /path/to/

Permissions to access the repository
$ chown -R apache:apache /path/to/

Setup SVN Users

Config file for the repository to allow users access to it
$ vi /path/to//conf/svnserve.conf

Uncomment the lines like so:
auth-access = write
password-db = passwd

Create a htpasswd file which will hold users and passwords for accessing to this repository
$ htpasswd -c /path/to//conf/passwd

Configure Apache

Edit the following file:
$ vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module modules/
LoadModule authz_svn_module modules/
DAV svn
SVNPath /path/to/
Authtype Basic
AuthName "My Repository"
AuthUserFile /path/to//conf/passwd
Require valid-user

The path /svn is where the repository will be served out of.
Finally, restart apache for new configuration to take affect:
$ service httpd restart