Subversion and Virtualmin

Introduction to Subversion

Subversion (also known as SVN) is a source-code control system that allows multiple developers to work on the same project. Each developer has a copy of some or all of the source code of the project on his workstation, and can check in changes to that repository which are then uploaded to a central server. Other developers can then fetch those changes by synchronizing their files with the repository.

This documentation assumes that you already have a basic understanding of SVN and source code control systems. Rather than explaining how SVN works, it focuses on setting up repositories using Virtualmin.

Enabling the Subversion Plugin

Before you can use SVN with Virtualmin, you must first enable the plugin at System Settings -> Features and Plugins. Just check the box next to Subversion repositories , then click the Save button. If this plugin does not appear, you may need to first install it. On a Redhat, Fedora or CentOS system, this is easiest done with the following command, run as root :

yum install wbm-virtualmin-svn

on Debian or Ubuntu, the command is :

apt-get install webmin-virtualmin-svn

If activating the plugin fails due to SVN not being installed on your Virtualmin system, you will need to install it first. On Redhat, Fedora or CentOS the command for this is :

yum install subversion

while on Debian or Ubuntu, the command is :

apt-get install subversion

Enabling Subversion For A Domain

Once the plugin is installed, you can allow a virtual server to create SVN repositories as follows :

  1. Select the domain from the left menu, and click Edit Virtual Server
  2. In the Enabled features section check the box next to Allow Subversion repositories?
  3. Click Save Virtual Server

This will perform the setup needed for repositories to be accessed under the /svn URL path on this domain, but will not yet create any SVN repositories.

Creating A Subversion Repository

Once a domain has SVN enabled, you can add a repository to it like so :

  1. Select the domain from the left menu, then open the Services category and click Subversion Repositories
  2. In the Create Subversion Repository form, enter a name like myproject into the Repository name field.
  3. Select at least one existing user in the domain to have access to the new repository in the Grant access to users field.
  4. Click the Create button.

Once this is done your new repository will appear in the list on the Subversion Repositories page. It can then be accessed using any SVN client with a URL like http://yourdomain.com/svn/myproject .

Granting Access To A Repository

All SVN repositories created using Virtualmin allow write access only to authenticated users. Accounts can be created in the same way that you would create mailbox or FTP users, and existing users can be granted access to SVN repositories.

When creating or editing a user, the Other user permissions section of the Edit Mailbox page will have a field named Subversion login enabled?. Just select Yes, and in the Read/write access to repositories field select one or more repos to grant full access to. As soon as the user is saved or created his login and password will be able to checkin to and checkout from the selected repositories.

When logging in you only need to use the user's short username, which is the part to the left of the @ in his email address. For example, if the address was bob@webmin.com he would be able to login to SVN as just bob , even though his IMAP and FTP is bob-webmin.

Users can also be given permissions to read from selected repositories, using the Read-only access to repositories field on the Edit Mailbox page.

Managing Repositories

Once a repository has been created you can manage it using buttons on the Subversion Repositories page. These are :

  • Delete
    Removes the repository, including all files within it and all user permissions.
  • Email Notifications
    Configures email to be sent when files are checked into the repository.
  • Fix Permissions
    Ensures that all files in the repository have the correct ownership and permissions to allow access via HTTP.
  • Dump
    Exports the complete repository to a file.
  • Load
    Imports repository contents from a file created using the Dump button.
  • Anonymous Access
    Turns on or off read-only access with no authentication to the repository.