Installing Subversion on Debian 7.5

Apache Subversion is a software versioning and revision control system to maintain current and historical versions of files such as source code, web pages, and documentation. The development server caters for the hosting of the version control system and also allows for access to it over the HTTPS protocol.

Installing Subversion

To install Subversion, we execute the following command in a “root” shell.

apt-get install subversion subversion-tools

Creating the Subversion repository

To create the container and set the appropriate ownership and permissions for our Subversion repositories, we execute the following commands in a “root” shell.

mkdir -p /home/svn
chown www-data:www-data /home/svn
chmod 700 /home/svn

Installing the Apache Module

To enable the submission of files to Subversion over WebDAV, we install the necessary module by executing the following in a “root” shell.

apt-get install libapache2-svn

Configuring Apache

To configure Subversion, we will host it on a secure virtual host on Apache.

Virtual Host settings

The virtual host will use the IP address 192.168.100.15, using the certificate in /etc/ssl/CA/certs/sitename.cert and the private key in /etc/ssl/CA/private/sitename.key.nopass. Authentication will also be required using a htpasswd file in /etc/apache2/security/htpasswd.sitename.

To create this htpasswd file, we execute the following command in a “root” shell.

htpasswd -c /etc/apache2/security/htpasswd.sitename admin

We will then be prompted to enter a password for the user admin, and using these credentials we will be able to access the Subversion web interface.

Virtual Host Configuration

<VirtualHost 192.168.100.15:80>
    RewriteEngine on
    ReWriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>

<VirtualHost 192.168.100.15:443>
    ServerName sitename
    ServerAdmin webmaster@domain

    SSLEngine On
    SSLCertificateFile /etc/ssl/CA/certs/sitename.cert
    SSLCertificateKeyFile /etc/ssl/CA/private/sitename.key.nopass

    <Location />
        DAV svn
        SVNParentPath /home/svn

        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/security/htpasswd.sitename
        Require valid-user
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/sitename/error.log
    CustomLog ${APACHE_LOG_DIR}/sitename/access.log combined
</VirtualHost>

Enabling the Virtual Host

To enable the virtual host, we execute the following command in a “root” shell.

a2ensite sitename

To reload the configuration, we execute the following command in a “root” shell.

service apache2 reload
Advertisements

One thought on “Installing Subversion on Debian 7.5

Comments are closed.