Installing Subversion on Ubuntu

Assuming that apache is installed!

  1. Install packages
    apt-get install subversion libapache2-svn libapache-mod-dav
  2. Enable SSL
    a2enmod
    Add “Listen 443″ into httpd.conf if needed.
  3. Install SSL
    apt-get install ssl-cert
    mkdir /etc/apache2/ssl
    /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/site-name.crt
  4. Adding Basic Authentication:
    htpasswd2 -c -m /home/path-to/svn/project/.htpasswd username
  5. Configure site
    cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site-name
    nano /etc/apache2/sites-available/site-name

    <VirtualHost IP_ADDRESS:443>
    ServerName hostname
    DocumentRoot /home/path-to/svn

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/site-name.crt
    SSLProtocol all
    SSLCipherSuite HIGH:MEDIUM

    <Directory “/home/path-to/svn”>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from All
    SSLRequireSSL
    </Directory>

    ### project
    <Location “/svn/project”>
    AuthType Basic
    AuthName “Subversion Login”
    AuthUserFile /home/path-to/svn/project/.htpasswd
    Require valid-user
    </Location>
    </VirtualHost>

    a2ensite $SITENAME
    /etc/init.d/apache2 restart

  6. Adding repository
    mkdir /home/path-to/svn
    svnadmin create /home/path-to/svn/repos
    chown -R www-data:www-data /home/path-to/svn/repos
    chmod -R g+ws /home/path-to/svn/repos
  7. Enabling SVN
    Edit /etc/apache2/mods-available/dav_svn.conf
    DAV svn
    SVNParentPath /home/path-to/svn (for multi repositories)
    SVNPath /home/path-to/svn (for single repository)
    For non-anonymous access comment out:
    #<LimitExcept GET PROPFIND OPTIONS REPORT>
    #</LimitExcept>
  8. Finalization
    /etc/init.d/apache2 restart
  9. Initial Import and Checkout
    svn import --username username files https://hostname/svn/repos/testdir -m “Testing”

    svn co --username username https://hostname/svn/repos