Subversion Setup

I finally got past my hurdles with subversion problems. I was having trouble checking in on one repository, but not another.

This turns out to be a simple file permissions problem:


svn: Commit failed (details follow):
svn: Can't create directory '/svn/repository/db/transactions/0-1.txn': Permission denied

The simple fix is:


chown -R fluffy.apache /svn/repository
chmod -R g+w /svn/repository

I’ve managed to set up subversion access (via http://, https://, and svn://) on three different networks today.
I still need to tackle svn+ssh:// and using PAM or LDAP authentication. That’ll be next.

Subversion configuration for http

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


DAV svn
SVNPath /usr/local/svnrepo
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /svn/repository/conf/htpasswd
Require valid-user

Subversion configuration via virtualhost

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

<Location /svn>
        DAV svn
        SVNPath /usr/local/svnrepo

        <LimitExcept GET PROPFIND OPTIONS REPORT>
                AuthType Basic
                AuthName "Herculean Group Subversion Repository"

                #NOTE: this must be maintained separately from the svn passwd file which is plaintext
                #TODO: combine svn:// and http:// password file acess
                #TODO: svn+ssh:// access

                AuthUserFile /usr/local/svnrepo/conf/htpasswd
                Require valid-user
        </LimitExcept>
</Location>

VirtualHost Configuration

/etc/httpd/conf/httpd.conf

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost _default_:80>
</VirtualHost>

<VirtualHost _default_:443>
</VirtualHost>

include conf/vhosts/*.conf

Subversion Virtual Host

/etc/httpd/conf/vhosts/svn.example.com.conf

<VirtualHost *:80 *:443>
        ServerName svn.example.com

    <Location />
        DAV svn
        SVNPath /usr/local/svnrepo/

        <LimitExcept GET PROPFIND OPTIONS REPORT>
                AuthType Basic
                AuthName "Herculean Group Subversion Repository"
                AuthUserFile /usr/local/svnrepo/conf/htpasswd
                Require valid-user
                #NOTE: this must be maintained separately from the svn passwd file which is plaintext
                #TODO: combine svn:// and http:// password file acess        </LimitExcept>
    </Location>

</VirtualHost>

Setup for svnserve

To start the svnserve server (for svn:// protocol)

su -c 'svnserve -d -r /usr/local/svnrepo'

To view the repository:

svn list svn://east2.herculeangrp.org/usr/local/svnrepo/

To checkout:

svn checkout svn://svn.herculeangrp.org/usr/local/svnrepo/forgetmenot/trunk forgetmennot

To commit from your local copy:

svn commit

To change passwords or add a user (for use with svn:// protocol) edit:

/svn/repository/conf/passwd
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s