wiki.getshifting.com

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


subversion

Subversion

Summary: How to configure a subversion server.
Date: Around 2021
Refactor: 29 April 2025: Checked links and formatting.

When you've created a subversion server as described here at opensuse you really should add a repository, LDAP authentication and provide a backup:

How to Add a Subversion Repository to the Server

A separate IP address is needed for every repository if you want to use SSL to connect. The newly selected IP address should be added to the subversion server as an additional address. Next is to configure the Subversion repository (in this case the repository “it”).

Set Up a Project Repository

svnadmin create /srv/svn/it
chown -R wwwrun:www /srv/svn/it/

Create SSL Certificate

openssl genrsa -des3 -out /etc/apache2/vhosts.ssl/it.svn.company.local.key 1024
openssl req -new -key /etc/apache2/vhosts.ssl/it.svn.company.local.key -out /etc/apache2/vhosts.ssl/it.svn.company.local.csr

cp /etc/apache2/vhosts.ssl/it.svn.company.local.key /etc/apache2/vhosts.ssl/it.svn.company.local.key.org

openssl rsa -in /etc/apache2/vhosts.ssl/it.svn.company.local.key.org -out /etc/apache2/vhosts.ssl/it.svn.company.local.key
openssl x509 -req -days 3650 -in /etc/apache2/vhosts.ssl/it.svn.company.local.csr -signkey /etc/apache2/vhosts.ssl/it.svn.company.local.key -out /etc/apache2/vhosts.ssl/it.svn.company.local.crt

Create Log Directory

mkdir /var/log/apache2/it.svn.company.local

Create Apache Configuration

vi /etc/apache2/vhosts.d/it.svn.company.local.conf
<VirtualHost 10.10.10.100:443>
        ServerName it.svn.company.local

        ServerSignature on
        DocumentRoot /srv/svn/it/
        DirectoryIndex index.php index.html index.htm index.shtml
        LogLevel error
        HostNameLookups off

        ErrorLog /var/log/apache2/it.svn.company.local/error_log
        CustomLog /var/log/apache2/it.svn.company.local/access_log combined

        SSLEngine on

        #   Server Certificate:
        SSLCertificateFile /etc/apache2/vhosts.ssl/it.svn.company.local.crt

        #   Server Private Key:
        SSLCertificateKeyFile /etc/apache2/vhosts.ssl/it.svn.company.local.key

        #   Server Certificate Chain:
        SSLCertificateChainFile /etc/apache2/vhosts.ssl/svn.company.local-ca.crt

        #   Certificate Authority (CA):
        SSLCACertificateFile /etc/apache2/vhosts.ssl/svn.ompany.local-ca.crt

        #SSLPassPhraseDialog exec:/etc/apache2/vhosts.ssl/svn-passphrase.sh

        # I have different locations for different repositories

<Location />
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all

  DAV svn
  SVNPath /srv/svn/it/

  AuthBasicProvider ldap
  AuthType Basic
  AuthName "SubVersion"
  AuthLDAPURL ldap://ldap.company.local:389/OU=services,O=company?uid?sub
  Require ldap-group CN=AccessSubversion,OU=SecurityGroups,OU=services,O=company

</Location>
</VirtualHost>

Restart Apache

rcapache2 restart

Configure Backup

Create a directory in /srv/svn/backup, in this case:

/srv/svn/backup/full.it

Edit the crontab file and add the following line (and edit it for the just created repository), increase the first number with 5 from the previous line.

10 20 * * * root perl /srv/svn/fullbackup.sh -v -i 500 --out-dir /srv/svn/backup/full.it /srv/svn/it --compress
subversion.txt · Last modified: by 127.0.0.1