SVN/Websvn/Apache HOWTO on CentOS

First we will just install SVN and get your repository up and running with some users. For the purpose of this tutorial I'm going to be using CentOS, but it should be hard to find similar command on other flavours of Linux.

Install SVN

Install mod_dav_svn right away which is required to make SVN work with apache.

	yum install mod_dav_svn subversion
	

Create Repository

Once we have installed svn we want to create a repository somewhere.

	svnadmin create /opt/svnserve/<repository name>
	

Permissions

Since we will be accessing the repository through apache, we need to make sure the apache user has proper permissions to access the repository.

	chown -R apache:apache /opt/svnserve/<repository name>
    

Setup Some Users:

We are going to make some simple modifications to the conf file for the repository to allow users access to it.

	vi /opt/svnserve/<repository name>/conf/svnserve.conf
    

Uncomment the lines like so:

	anon-access = read
    auth-access = write
    password-db = passwd
	

Create htpasswd file and add some users to it.

	htpasswd -c /opt/svnserve/<repository name>/conf/passwd
    

Add some users to it:

	htpasswd /opt/svnserve/<repository name>/conf/passwd <username>
    

Configure apache

Here is will the mod_dav_svn module will come into play, we are going to setup a an apache conf file for svn that will give us http access to the repository. Create the following file:

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

And add the following into it, note that the path "/svn" is where the repository will be served out of:

	LoadModule dav_svn_module     modules/mod_dav_svn.so
    LoadModule authz_svn_module   modules/mod_authz_svn.so

    <Location /svn>
        DAV svn
        SVNPath /opt/svnserve/<repository name>
        Authtype Basic
        AuthName "My Repository"
        AuthUserFile /opt/svnserve/<repository name>/conf/passwd
        Require valid-user
    </Location>
	

Restart apache:

	service httpd restart
	

Access the repository

Now we simply type the address of where we are hosting the repository into our browser and we should be all set.

	http://<domain>/svn
    

Note that this process can be repeated for multiple repositories on the same server, just make sure the paths in your <Location> directive are different.

LiveZilla Live Help