By: Matt Krass Last Updated: 4/11/07. Setting up a Subversion repository. What is Subversion?. Version Control System Backup of files Ability to work from anywhere with an Internet connection Multiple Programmers can work on something without conflict. How do I use Subversion?.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
By: Matt Krass
For the command line client, the two most common options are to check out and commit changes.
$ svn checkout https://storage.sclab.clarkson.edu/svn/myrepository
This will prompt for your username/password combination to access the server.
$ svn commit
This will prompt for a log message, as well as your login details, then commit
the differences between your local working copy and the server’s repository.
First, we must install Subversion, this is easy to do on Ubuntu/Debian via the apt-get command.
$ apt-get install subversion subversion-tools
This installs Subversion, tools to help maintain Subversion, and dependencies.
Now we need to create a place to store the repositories and configuration files. I will be using /svn for the base, then I store the repositories in /svn/repos/public and /svn/repos/private.
There’s a few configuration files you’ll need:
/svn/svnauth – a list of which users can do what to which repositories
/svn/svnusers – a list of users and hashed passwords, similar to the systems /etc/passwd file
To generate the svnusers file, use Apaches htpasswd2 utility.
$ htpasswd2 –c /svn/svnusers <your preferred username>
This will create the file and prompt you for a password for your first user. Run without the –c flag to
update an existing svnusers file with a new user.
Before we can create the svnauth file, we need a repository to set the permissions for, so we need to
create one. The command for this is svnadmin with a create parameter.
Inside the /svn/repos/public or /svn/repos/private subdirectory, use this to make a new
$ svnadmin create reponame
Now we need to make your username authorized to read and write to it, lets create the svnauth file
username = rw
guest = r
This allows the user username to read/write to the repository, while the user guest can only read
from it. Add users and repositories as needed. This can all be done with something simple like emacs
Subversion is now all set up, time for Apache. On most distributions you can set up Apache with either
apt-get or yum, and installing the required packages. Ubuntu/Debian’s apt-get install also pulls in
various other packages including the SSL support you need for a secure repository.
$ apt-get install apache2
Once installed, it must be configured and set up, on a Ubuntu/Debian system the apache2 service
should automatically be set to start with the computer. If you need to start it manually you can use this
$ /etc/init.d/apache2 start
Apache maintains different “sites” to run, and they’re all stored as individual configuration files in
/etc/apache2/sites-available/ and they’re enabled by symlinking to the file in
There are a few modules, addons to Apache that will be necessary for this to work, such as the
dav, dav_fs and dav_svn modules. This are easy to install in a Ubuntu/Debian system through
the apt-get command.
$ apt-get install libapache2-svn
Once installed the modules must be “enabled” for use by Apache, the easiest way to do this is with the
Which module would you like to enable?
Your choices are: actions asis auth_anon auth_dbm auth_digest auth_ldap cache cern_meta cgi cgid dav dav_fs dav_svn deflate disk_cache expires ext_filter file_cache headers imap include info ldap mem_cache mime_magic php5 proxy proxy_connect proxy_ftp proxy_http rewrite speling ssl suexec unique_id userdir usertrack vhost_alias
Simply repeat this process three times, selecting dav, dav_fs and dav_svn.
Now, you need a site file for SVN. You can either modify the
/etc/apache2/sites-available/default site file or create a new one for SVN, I generally
create a site file named svn, and either modify/delete default as per my need. The contents of the file
look like this:
AuthName "COSI Subversion Repository"
Once you’ve created your site file in Apaches sites-available directory, you must link it to
sites-enabled and restart Apache
$ ln –s /etc/apache2/sites-available/svn /etc/apache2/sites-enabled/001-svn
$ /etc/init.d/apache2 restart
Once that’s done, your website should be up for SVN hosting, provided all the required modules are
Installed and the configuration file completed properly. If there are any errors or Apache fails to restart,
Check /var/log/apache2* for details regarding the problem.
To disable SVN hosting all you need to do is use unlink to remove the symlink to the file, and restart
$ unlink /etc/apache2/sites-enabled/001-svn
$ /etc/init.d/apache2 restart
And the repository is down, for maintenance, backups, irritating your peers, whatever reason.
You should be all set, to summarize, you’ve installed and configured Subversion, created a repository
and set up a user list and a permission list. You’ve then installed and configured Apache to use the
Subversion module pack to access the repository, authenticating against the user/permission lists
you’ve created. Let’s just end with some quick troubleshooting tips:
chmod 777 ./
from the system root directory, or you’ll know what I feel like :-)
If you need to reach me for any questions
you can get me at
IRC: KC2RGZ @ comm.sclab.clarkson.edu/#cosi