Published January 15th, 2006 by Jim O'Halloran

Subversion Server on CentOS 4.2

I decided it was time to bite the bullet and set myself up with a subversion repository for a project I may start on in the near future. I couldn’t find find a quick guide to setting up a repository on CentOS, so this is how I did it. Based on Chapter 6 (Server Configuration) of the subversion book, and the config files.

First up we needed to get subversion installed. This is pretty easy, CentOS has subversion packages.

yum install subversion mod_dav_svn

Next up I created an entry in DNS for the domain I wanted to host subversion on. I then added the following to the httpd.conf to create a vhost for subversion.

<virtualhost *:80>
    ServerAdmin [My Email]
    DocumentRoot [Path]
    ServerName [Host Name]
    ErrorLog logs/svn-error_log
    CustomLog logs/svn-access_log combined
    <location />
        DAV svn
        SVNPath [Path - same as DocumentRoot]
        AuthType Basic
        AuthName "Subversion repository"
        AuthUserFile /etc/svn-auth-file
        Require valid-user
    </location>
</virtualhost>

Next up create the user file, the folloring command takes care of that, then we can restart apache so the config changes take effect:

htpasswd -c /etc/svn-auth-file jim
service httpd restart

Next up, we create the directory we specified as the DocumentRoot above. Finally, change into the directory we just created, and use svnadmin to create the repository and set the ownership to the apache user.

svnaddmin create .
chown -R apache:apache

After that I was able to check out a working copy of the (empty) repository, and we were off and running.


5 Responses to “Subversion Server on CentOS 4.2”

Feed for this Entry Trackback Address
  1. 1

    Matt Says

    Great guide Jim, thanks it really helped me out. One small note, if you’re like me and you are going to be running svn off your main domain name you don’t need all of the virtual host block, you can just put the location block in your config with a path, like:

    DAV svn
    SVNPath [Path - same as DocumentRoot]
    AuthType Basic
    AuthName “Subversion repository”
    AuthUserFile /etc/svn-auth-file
    Require valid-user

    And then your url will be http://maindomain/svn.

    This might be obvious to people, but just in case it isn’t…

  2. 2

    jart Says

    Great guide Jim!

    Readers, you may want to check out the configuration example that comes with the RPM in:

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

  3. 3

    Chuck Says

    Humm, about an example authentifying with LDAP against Active Directory or eDirectory ? This would be more convinient in a real world :)

  4. 4

    Stan Says

    Thank you for the reference, I do agree with Matt and jart though, for what I needed at least.
    As a result you get a nice svn installation with only one problem - python hook scripts don’t work right. It may not sound like much, but when you want to make sure that committers leave a commit note, or a ’special’ commit note, or if you want to manage the times or the conditions when commits by some and not the others are done, you need it. If anyone’s interested - I’ll come back and post something about the solution. So far I’ve managed it by re-compiling apache a certain way, perhaps there’s a better way.

  1. 1

    Setup Subversion and Trac on CentOS 5 | Daniel Skinner: News and Articles on Web Development

    Pingback on Jan 7th, 2008 at 2:50 am

Leave a Reply

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>