Introduction
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
production:
auto_create: false
deny_delete: false
pre_create: /usr/local/bin/pre-create.sh
post_create: /usr/local/bin/post-create.sh
pre_delete: /usr/local/bin/pre-delete.sh
post_delete: /usr/local/bin/post-delete.sh
svn:
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 http://svn.s-andy.com/scm-creator $ 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/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
Configure Apache to serve SVN in redmine.example.com/svn:
$ cat /etc/apache2/sites-available/redmine.example.com.conf
PerlLoadModule Apache::Redmine
<VirtualHost your-server-ip:80>
SuexecUserGroup "#1012" "#1012" # fill these in from the automatically generated values in the config file
ServerName redmine.example.com
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
<Limit GET PROPFIND OPTIONS REPORT>
Require valid-user
Allow from server-ip-address
Satisfy any
</Limit>
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
RedmineDSN "DBI:mysql:database=redmine_default;host=localhost"
RedmineDbUser "redmine"
RedmineDbPass "redmine-db-password"
</Location>
</VirtualHost>
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 "http://redmine.example.com/sys/fetch_changesets?key=API-KEY" > /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 http://redmine.example.com/svn/[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 http://aeturnalus.com/software/redmine-git-hosting-setup-ubuntu-12-04-lts/
Note that you will have to resolve conflicts between the two plugins as per http://aeturnalus.com/software/hacking-scm-creator-redmine-git-hosting-cooperate/, but it’s a fairly simple fix.

Pingback: Installing Redmine in Ubuntu 12.04 with Virtualmin | Aeturnalus
Pingback: Hacking SCM Creator and Redmine Git Hosting to Cooperate with one another | Aeturnalus
Pingback: Redmine Git Hosting Setup on Ubuntu 12.04 LTS | Aeturnalus
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.
Hi,
Seems that the plugin “Redmine SCM Creator” does not work with 1.4.0+ version of redmine.
http://projects.andriylesyuk.com/issues/2025
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.
OK. I didn’t notice that you were talking about ubuntu repositories. On redmine website, I see redmine 1.4.0 : http://www.redmine.org/projects/redmine/wiki/Download
May be a solution will come.
cheers,
David
SCM Creator now works with 1.4 and 2.0. Sorry for delay.
Thanks for this article, Robert!
Thanks for sharing a nice article
how to install svn on ubuntu
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 http://svn.s-andy.com/scm-creator 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!
Hello Brian
on vendor/plugins/scm-creator/app/views/projects/_scm.html.erb,
try to edit ‘redmine_scm’ to ‘scm-creator’