Svn via https

From Andreida
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Install apache, https-svn package and subversion itself:

apt-get install apache2 libapache2-svn subversion

OR (if libapache2-svn is not available)

apt-get install apache2 libapache2-mod-svn subversion

Enable the ssl mod:

a2enmod ssl

Perhaps, if a2enmod is unknown: Make sure /usr/sbin is in PATH, for example source /etc/profile in ~/.bashrc (.profile was not sourced for me)

Check the listen ports: (443 is normal ssl)

vi /etc/apache2/ports.conf

Copy the default site to your new site

cd /etc/apache2/sites-available
cp default-ssl.conf svn-ssl.conf

Enable the site

cd /etc/apache2/sites-enabled
ln -s ../sites-available/svn-ssl.conf

Enable dav: (just follow the instructions)

vi /etc/apache2/mods-available/dav_svn.conf

Example:

<Location /svn>
  DAV svn
  SVNParentPath /var/reps
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  Require valid-user
</Location>

Enable the security:

a2enmod authn_file
a2enmod auth_basic

Create user and password

htpasswd -c /etc/apache2/dav_svn.passwd myuser

Add user and password

 htpasswd /etc/apache2/dav_svn.passwd myuser2

Edit the per directory permissions:

vi /etc/apache2/dav_svn.authz
[repository1:/]
harry = rw
sally = r

[repository1:/path/somewhere]
sally = rw

[repository2:/]
sally = rw

Create the repositories:

cd /var/reps
svnadmin create demo-1
svnadmin create demo-2
svnadmin create demo-3

Allow the webserver to read and write the svn files:

chown -R  www-data:www-data /var/reps
chmod -R  770  /var/reps

Now check your firewall rules for 443/https and do a

/etc/init.d/apache2 restart
svn list --username myuser https://www.yourDomain.com/svn/demo-1