msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

19 Sep 10 SVN + WebSVN(SSL) Installation in Debian Squeeze

These instructions show how to install the SVN system and the WebSVN via Apache SSL connection.
These instructions don’t explain much, I hope your are Linux/Apache savvy enough to understand them.

Install the needed Debian packages
apt-get install subversion libapache2-svn openssl ssl-cert
a2enmod ssl
a2enmod dav_svn

Everything in the dav_svn.conf configuration file is already disabled.
You can refer to it for more instructions on how to configure the module.

Create subversion repositories:
mkdir -p /var/svn
chown -R www-data:www-data /var/svn

All our subversion repositories should be located in /var/svn in order to be visible to Apache.
You can change /var/svn to any directory but you must configure WebSVN later accordingly.

Apache DAV_SVN and WebSVN Configuration
Lets move the default SSL configuration symlink out of the way
rm /etc/apache2/sites-enabled/default-ssl &>/dev/null

Create own SVN access configuration under an SSL VirtualHost as follows:
touch /etc/apache2/sites-available/ssl.conf
ln -s /etc/apache2/sites-available/ssl.conf /etc/apache2/sites-enabled/001-ssl.conf

Edit the file /etc/apache2/sites-available/ssl.conf and add this content.

<VirtualHost *:443>
     DocumentRoot /var/www
     # Authentication for all acesses here
     <Location />
          AuthType Basic
          AuthName "Subversion Repository"
          AuthUserFile /etc/apache2/dav_svn.passwd
          Require valid-user
     </Location>
     # ------------------ SVN ---------------------------------
     <Location /svn>
          DAV svn
          SVNParentPath /var/svn
          # this line must be added if you want SSL enabled
          SSLRequireSSL
     </Location>
     # ------------------WebSVN Client interface --------------
     <Directory /var/www/websvn>
          Options -Indexes +FollowSymlinks
          DirectoryIndex index.php
     </Directory>
     # ----------------- Some Extra SSL configuration needed ---------------
     <FilesMatch "\.(cgi|shtml|phtml|php)$">
          SSLOptions +StdEnvVars
     </FilesMatch>
     <Directory /usr/lib/cgi-bin>
          SSLOptions +StdEnvVars
     </Directory>
     # Solving the IE problems
     BrowserMatch ".*MSIE.*" \
          nokeepalive ssl-unclean-shutdown \
          downgrade-1.0 force-response-1.0
     SSLEngine on
     #Using Debian self-signed certificate
     SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
     SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key....
</VirtualHost>

Create authentication users
Create the authentication file(-c) and the first user (user1)
htpasswd -c /etc/apache2/dav_svn.passwd user1
Create the second user (user2)
htpasswd /etc/apache2/dav_svn.passwd user2

Restart Apache2
/etc/init.d/apache2 restart

Subversion Testing
svnadmin create /var/svn/test
chown -R www-data:www-data /var/svn/test
svn co https://new.site/svn/test

It should says “Checked out revision 0.”, otherwise try looking for the errors on the Internet.
You probably forgot some steps or I forgot to mention some details.

WebSVN client Installation


Get the package from the source in Internet
mkdir -p /var/www/
cd /var/www
wget http://websvn.tigris.org/files/documents/1380/49056/websvn-2.3.3.tar.gz
tar fvxz websvn-2.3.3.tar.gz
ln -s websvn-2.3.3 websvn
cp websvn/include/distconfig.php websvn/include/config.php

Edit /var/www/websvn/include/config.php.
Add the following line:
$config->parentPath('/var/svn');
You can set many other options but many of the default settings are enough for now.
Try webSVN interface:
https://server.name/websvn
After authenticating you should see the repository TEST (Top left of the browser)
This the TEST repository we created previously during the ‘svn testing’

Reader's Comments

  1.    

    You saved me about 3 days of work.
    Perfect, concise.
    Bless you 🙂

    Reply to this comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: