SVN Repository Management with Redmine on Ubuntu 12.04


Managing repository management is always a hassle for network administrators, as it usually involves going into into the shell to create the repository itself.

Redmine solves this problem using reposman.rb, which can be run regularly by a cronjob and thus automate repository creation. But this is still inconvenient—you still need to wait for the repository to be created, and you can only manage one type of SCM at once. Thus, we are going to install and configure the Redmine SCM Creator plugin to manage repository creation for us.

This tutorial is oriented primarily towards setting up SVN repository creation, as git repository management is better done by the Redmine Git Hosting plugin (Setup Guide). For instructions on how to set up Redmine, visit this tutorial before continuing on.

Once again, this tutorial will assume that you are running all commands from the root user, unless otherwise noted. Do NOT use the root user as your primary account, it should be restricted to setup and administration only.

Step 1: Setting up the SVN repository location

We’ll start by creating the SVN repository hosting location at /var/svn, and setting it to the correct permissions:

$ mkdir /var/svn
$ chown www-data:www-data /var/svn
$ chmod 755 /var/svn

Step 2: Creating the Redmine SVN Creator Configuration File

Edit the file at /usr/share/redmine/config/scm.yml, and set its contents as follows:

$ cat /usr/share/redmine/config/scm.yml
  auto_create: false
  deny_delete: false
  pre_create: /usr/local/bin/
  post_create: /usr/local/bin/
  pre_delete: /usr/local/bin/
  post_delete: /usr/local/bin/
    path: /var/svn
    svnadmin: /usr/bin/svnadmin
    url: svn

For more information about the configuration options, visit this wiki page

Step 3: Installing the plugin

We’re now actually going to install this plugin into redmine:

$ cd /usr/share/redmine/
$ ./script/plugin install
$ rake db:migrate_plugins RAILS_ENV=production

Restart apache to see if this plugin installed properly:

$ service apache2 restart

Now, if you create a new project and go to the Project→Settings→Repositories tab, you should be able to select “Subversion” and create a repository.

Step 4: Setting up SVN with WebDAV, Apache, and Redmine authentication

Installing packages

Start by getting the required packages to configure SVN through Apache:

$ apt-get install libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libdigest-sha-perl libauthen-simple-ldap-perl

Enable SVN via WebDAV:

$ a2enmod dav
$ a2enmod dav_svn
$ a2enmod perl

Set up authentication

Link the the Redmine authentication module to Apache, so we can load it the configuration file.

$ ln -s /usr/share/redmine/extra/svn/ /usr/lib/perl5/Apache/

Configure Apache to serve SVN in

$ cat /etc/apache2/sites-available/
PerlLoadModule Apache::Redmine

<VirtualHost your-server-ip:80>
  SuexecUserGroup "#1012" "#1012" # fill these in from the automatically generated values in the config file
  ErrorLog /var/log/virtualmin/redmine.example.com_error_log
  CustomLog /var/log/virtualmin/redmine.example.com_access_log combined

  DocumentRoot "/usr/share/redmine/public"
  PassengerResolveSymlinksInDocumentRoot on
  Options Indexes ExecCGI FollowSymLinks

  <Location /svn>
    DAV svn
    SVNParentPath "/var/svn"
    Order deny,allow
    Deny from all
    Satisfy any

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler
    AuthType Basic
    AuthName redmine

      Require valid-user
      Allow from server-ip-address
      Satisfy any
      Require valid-user

    RedmineDSN "DBI:mysql:database=redmine_default;host=localhost"
    RedmineDbUser "redmine"
    RedmineDbPass "redmine-db-password"

Replace redmine, redmine_default, and redmine-db-password with the appropriate values for your configuration.

Step 5: Add a cronjob to regularly update the repository listings

Redmine normally only checks for updates to the repository when you access the project ‘repository’ tab, which can be somewhat clumsy when you want to see the repository updates in closer to real time. Thus, we will setup a regular cronjob to fetch new updates every minute:

Enable WS for repository management

Go to Administration→Settings→Repositories, and check “Enable WS for repository management”, and generate a random API key for use later.

Edit the crontab with the following command:

$ crontab -e

and add the following line to the end:

* * * * * curl "" > /dev/null 2>&1

Make sure that you have curl installed with the following command:

$ apt-get install curl

Save the crontab, and you’re done with this step.

Restart Apache and have fun!

At this point, you have a working SVN repository creation and authentication system, synchronized with and controlled by Redmine. You should be able to check out the project repositories at[project-identifier], and track the progress of the repository within Redmine.

What’s next?

If you would also like to put together a fully functional Git hosting solution, check out

Note that you will have to resolve conflicts between the two plugins as per, but it’s a fairly simple fix.

11 Responses to “SVN Repository Management with Redmine on Ubuntu 12.04”

  1. Argh, brainfart, I seohmow completely missed the third paragraph The git svn branch part is really just the branch creation (like svn cp trunk branch ). After that, you should have a new remote tracking branch (see git branch -r ) and can rebase your stuff onto it, like:git rebase onto $new_svn_branch master $git_branchWhat that does is that it turns the commits in the range master..$git_branch into patches, applies them on top of $new_svn_branch and then updates $git_branch to reference the result.And then git svn dcommit -n should tell you that it’s going to dcommit your stuff to the new svn branch.

    • Robert Ying

      Thanks for the update! I’ll search around for a solution—the current version of Redmine installed via the repositories is 1.3.2-stable, so I didn’t notice the issue at all. There are no such issues reported with the Redmine Git Hosting Plugin.

      I’ll update this post when I find a satisfactory alternative. In actuality, it really isn’t difficult to create SVN repositories, so I may even end up writing something on my own.

  2. Brian Tafoya

    Thanks for the guide, ran into one problem. When I go to create a new project, I get a 500 error. Log states…

    ActionView::TemplateError (No plugin called ‘redmine_scm’ – please use the full name of a loaded plugin.)…

    I noticed your guide states ./script/plugin install so I am assuming the dash and underscore present a problem?

    Using Redmine 1.3.2.stable (MySQL) on Ubuntu Precise and Virtualmin. Everything else seems to be working!

    Any help would be appreciated!

  3. masatoshi ishida

    Hello Brian

    on vendor/plugins/scm-creator/app/views/projects/_scm.html.erb,
    try to edit ‘redmine_scm’ to ‘scm-creator’


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>