Subversion server using HTTPS on Ubuntu Hardy setup

Yay, it’s up and running! And here are the steps to do it, mostly copied directly from the shell as I ran them. In any case, it may or may not work for you, so make sure you check with the proper documentation if anything fails.

By the way: Back up old repositories if you have any!

  1. Install the software:
    sudo apt-get install apache2 libapache2-svn openssl ssl-cert subversion
  2. Create directory for server certificates:
    sudo mkdir /etc/apache2/certs
  3. Create password-free SSL certificate (remember what you put as “Host Name” for the next step):
    sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/certs/server.pem
  4. Add the Apache certificate settings to /etc/apache2/httpd.conf (use the “Host Name” value from the previous step instead of “” to avoid a warning in /var/log/apache2/error.log):
    SSLEngine on
    SSLCertificateFile /etc/apache2/certs/server.pem
  5. Enable Apache SSL module (necessary for HTTPS):
    sudo a2enmod ssl
  6. Create directory for Subversion repository files:
    sudo mkdir /var/lib/svn
  7. If you have any old repositories, copy them to /var/lib/svn/, and make sure the Apache user can read & write them:
    sudo chown -R www-data:www-data /var/lib/svn/
  8. Create Apache’s Subversion password file with one user (replace username with one of your choice):
    sudo htpasswd -c /etc/apache2/dav_svn.passwd username
  9. Uncomment the following lines in /etc/apache2/mods-available/dav_svn.conf to point Apache to your repositories:
    <Location /svn>
      DAV svn
      SVNParentPath /var/lib/svn
      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/dav_svn.passwd
        Require valid-user
  10. Disable the default site (it clashes with the SSL settings somehow):
    sudo a2dissite default
  11. Restart Apache:
    sudo /etc/init.d/apache2 restart
  12. Test (replace repository_name with an existing repository name):
    svn co https://localhost/svn/repository_name



2 thoughts on “Subversion server using HTTPS on Ubuntu Hardy setup

  1. Hey, thanks! This saved me a lot of headaches when setting up my own svn server. Just one addition, it’s probably wise (such as suggested in the first article) to make a specific group for subversion, and users to that so it’s possible to login with multiple users. (You just need to remember to run htpasswd for all of those users too).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s