Installing subversion using subdomain on Apache and Debian

Here’s a quick reference on the basics of installing Subversion on Debian using an Apache subdomain both for my own reference and others too. There were a couple of bits I had to search around for so I thought an all-in-one guide might be useful for others.

Install subversion.

apt-get install subversion

Install Apache and the SVN module for it.

apt-get install libapache2-svn apache2

Create the subversion root directory.

mkdir -p /svn

Create a repository.

svnadmin create /svn/default

Give apache rights on the root directory and its contents.

chown -R www-data:www-data /svn

Enable dav and svn modules on Apache.

a2enmod dav
a2enmod dav_svn

If you want to use a subdomain for svn like set up a vhost as follows.

Note: Don’t forget to replace the IP with your own.

  ErrorLog /var/www/
  CustomLog /var/www/ combined
  <Location />
    DAV svn
    SVNParentPath /svn
    SVNListParentPath on
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /auth/svn/default/htpasswd
    Require valid-user
  <Location /default>
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /auth/svn/default/htpasswd
    Require valid-user

Obviously configure the above to match your requirements.

Create the Apache log directory specified above.

mkdir -p /var/www/

Give Apache rights to the log directories you’ve set up above.

chown -R www-data:www-data /var/www/

Create a password file with your chosen username.

htpasswd -s -c /auth/svn/default/htpasswd USERNAME

Restart apache and test your setup.

/etc/init.d/apache2 restart

Note: The following configuration in the above vhost config specifies the location in the filesystem of a parent directory whose child directories are Subversion repositories.

SVNParentPath /svn

Note: And the following configuration in the above vhost config allows a GET of SVNParentPath, which results in a listing of all repositories under that path. This means that you can go to in your browser and see a listing of repositories underneath it.

SVNListParentPath on

That’s it. For further details see the svn book. Thanks to the excellent library article by for providing me with a concise introduction which I could adapt for my own needs. If you are not already hosting with you should be. They are the best hosting provider in the world.

Was this post helpful to you? Please let me know in the comments!

4 thoughts on “Installing subversion using subdomain on Apache and Debian

  1. Dhruba Bandopadhyay Post author

    I thought its illustrative purpose was adequately self explanatory and I wasn’t aware of any convention for this purpose. Besides anyone who gets confused between the two will need resources far more expansive than my guide!

  2. Dhruba Bandopadhyay Post author

    Bruce, I’ve made the substitution that you suggested. I went to and found the following text.

    As described in RFC 2606, we maintain a number of domains such as EXAMPLE.COM and EXAMPLE.ORG for documentation purposes. These domains may be used as illustrative examples in documents without prior coordination with us. They are not available for registration.

    So I stand corrected. If IANA is indeed holding these domains for example purposes then that is a convention indeed. Thanks.

  3. Pingback: Setting up an SVN repository on a subdomain - Just just easy answers

Leave a Reply