Subversion: Repository on Subdomain
Oct 24, 2009
1 minute read

This is a tutorial on how to setup a Subversion repository on a subdomain with Apache. This assumes you have Subversion and Apache already installed on your system.

Subversion Setup

First you need to create a repository somewhere in your file system. Then grant apache permissions on that directory.

svnadmin create /var/svn/repository<br /> sudo chown -R www-data:www-data /var/svn/repository

Controlling Access

Access to the repo via the web will be controlled by an htpasswd file located at /var/svn/svn-auth-file. Use the htpasswd command to create the file.

htpasswd -c /var/svn/svn-auth-file <username>

Execute the script again without the -c argument to add more people to the list.

htpasswd /var/svn/svn-auth-file <username_two>

Apache Setup

I usually setup Apache to use Names VirtualHosts to handle multiple websites. We’ll make a new named virtualhost for subversion repository.

<VirtualHost *:80><br /> ServerName svn.your_domain.com<br /> <location /><br /> DAV svn<br /> SVNPath /var/svn/repository

AuthType Basic<br /> AuthName "Subversion repository"<br /> AuthUserFile /var/svn/svn-auth-file<br /> Require valid-user<br /> </location><br /> </VirtualHost>