Subversion

From openSUSE

A Concurrent Versioning system similar to but better than CVS.

Subversion does the same thing CVS (Concurrent Versioning System) but has major enhancements compared to CVS.

Contents

Subversion

This is the subversion logo.
Developer: Many! Ask mailinglist for details.
Package Info (pin)
License: GNU GPLv2
Website: http://subversion.tigris.org/

About

Subversion is an open source version control system, similar to and intending to replace CVS. It allows computer software to be developed in an incremental and controlled fashion by a distributed group of programmers.

For more details see the Wikipedia Article.


Install

Installing Subversion on openSUSE is nearly simple:

  • install the subversion package
  • see /usr/share/doc/packages/subversion/README.SuSE:

As subversion repositories can be served either via http (wich is the common way), or via the svnserve daemon and a special network protocol, you should decide between the two options. Both can run on the same machine without big problems. But if you already have an apache webserver up and running on your machine, there is no need for an additional daemon like svnserve.


Running svnserve

svnserve should not run as root user. The startup script rcsvnserve expects a user/group named 'svn', but this user/group must be created before first use:

groupadd -r svn
useradd -r -g svn svn

BTW, the name of this user is configurable with YAST2 Network Services: select Network Services (xinetd), then select the "svn" service. YAST2 writes this configuration in /etc/sysconfig/svnserve.

Unfortunately, the default install from openSUSE sets up svnserver to run in "readonly" mode. This means that, by default, you won't be able to commit anything to the repositories you create. As root edit /etc/sysconfig/svnserve and change:

SVNSERVE_OPTIONS="-d -R -r /srv/svn/repos"

to

SVNSERVE_OPTIONS="-d -r /srv/svn/repos"

Create a repository with the svnadmin create command (here I'll make a repo called my_repository). As root

mkdir -p /srv/svn/repos/my_repository

- see the documentation at the subversion site for more information.

Edit the repository configuration files, which are in the conf directory within the repository. This allows you to set access rights. Ensure there are no leading or trainig spaces on uncommented lines or the service will not work. Go to your repository, enter the conf directory and edit svnserve.conf to:

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write
...
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd

Now edit passwd to something like:

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
mynewuser = test


Make sure that the files of the repository are accessible by the user "svn". It would be best to give exclusive read and write access of the whole repository directory tree to the user svn. Again, as root:

chown -R svn:svn /srv/svn/*

You can use YAST2 to change the default repository location that svnserve should serve: Network Services - Network Services (xinetd). Select "svn" and edit the Server Arguments to specify the repository root path.

If you want to be able to access the subversion repository through a router (that uses NAT), you have to forward port 3690 to the server. Use the "svn:" prefix to access this repository from the client; most Subversion clients ask for a URL to locate the repository. You should enter something like:

svn://my-account-name.dyndns.org

Configure Apache for SVN

To run a subversion server via apache, you need to configure apache2 to load two apache2 modules: mod_dav and mod_dav_svn. (mod_dav is needed by mod_dav_svn, it is installed together with apache2.)

This is done by adding the dav and dav_svn modules to /etc/sysconfig/apache2 (just add the two modules to the "APACHE_MODULES" line) and restarting the server (rcapache2 restart).

A default/example configuration of the dav_svn module can be found in /etc/apache2/conf.d/subversion.conf. With more recent apache packages, this configuration is *not* loaded automatically by the apache server, since many people configure virtual hosts and it is unlikely that the repositories shall be available from any virtual host. To load the configuration for a certain virtual host, add

 Include /etc/apache2/conf.d/subversion.conf

or

 Include /path/to/your_subversion_configuration

in the respective virtual host configuration. This *may* be done in the default virtual host (/etc/apache2/default-server.conf).


See Also

External Links