Installing and Creating a new SVN Repository

Note: This is the second time I’m writing this entry since RZ somehow managed to lose my first post. So these steps are from memory and might not be 100% correct.

If you want to install subversion, you will need to have apache. Easiest way to install this is via yum (or whatever package manager you need to use).
yum install subversion mod_dav_svn httpd

Once complete, you should have a directory in /etc/httpd/conf.d/subversion.conf.

We will create the repos in /home/subversion. I’ll also make a user ‘subversion’ who can manage these files without root. As root, run the following commands:

  1. useradd subversion
  2. cd /home/subversion

To create a new repo:

  1. Create the directory for the new repo. eg: 'repo'
  2. run 'svnadmin create repo'

To create the initial import of the trunk:

  1. mkdir /tmp/trunk
  2. svn import /tmp/trunk file:///home/subversion/repo/trunk -m "Initial Import"

You may want to add users to access this repo. Suppose you want to add user:

  1. cd /home/subversion/repo/conf
  2. htpasswd -cm svn-auth first_user
  3. htpasswd -m svn-auth second_user


Note: do not use the -c argument after adding the first user, otherwise it will overwrite the existing password file.

You will then need to add an entry to /etc/httpd/conf.d/subversion.conf with the following:


        DAV svn
        SVNPath /home/subversion/repo

        AuthType Basic
        AuthName "Subversion Repo for MyRepoName"
        AuthUserFile /home/subversion/repo/conf/svn-auth
        Require valid-user

Ensure the files in /home/subversion/ are owned by apache, but still is group owned by subversion.

You should now be able to access your new repo by going to /svn/repo after using the username/password combination given to htpasswd above.

Leave a Reply

Your email address will not be published.