Pedro's Space

A place to share my thoughts with the world.

Archive for July 2011

Setting up Subversion on ReadyNAS Duo

with 5 comments

It’s always a bit of a pain trying to figure how to do something technical from information on blogs or forums. More often than not, the author has missed out some vital step or piece of information or you have to piece together what to do from a number of sources and figure out how to fill in the blanks.

So here’s my attempt at a more complete set of instructions on how to install and set up Subversion on the ReadyNAS Duo network attached storage.

Get what you need

First you’ll need to download the following addons:

If you want a basic web frontend for Subversion, you an also download:

WebSVN requires the PHP addon.

You’ll also need a secure shell client, Windows users can download putty.

Install the Add-ons

Once you’ve downloaded everything, install the add-ons on your NAS.

To do this:

1. Log in to the admin area of your NAS (https://<ip address of your nas or server name>/admin)

2. From the menu click ‘System’ –-> ‘Update’.

3. Select the ‘Local’ tab.

4. Click the ‘Choose File’ button and navigate to the .bin file for the addon that you want to install.

5. Click the ‘Upload and Verify Image’ button. You should see the message ‘The firmware update or Add-on image is valid. Click Perform System Update if you wish to install the image now.’

6. Click on the ‘Perform System Update’ button.

7. Repeat steps 4 – 6 for all the addons that you require.

Note that some addons will require the server to be restarted.

Pitfalls: If you get an error message at step 6 check that you’ve downloaded the version of the plugin that matches the processor in your NAS (x86 or sparc).

Now that you’ve got everything installed, we’ll need to enable the plug ins.

To do this:

1. Log in to the admin area of your NAS.

2. From the menu click ‘Services’ –> ‘Installed Add-ons’.

3. Ensure that Subversion is checked, and if you are using WebSVN ensure that both WebSVN and PHP are checked.

4. Click ‘Apply’ to apply changes.

Create a repository (SSL Method)

Next we need to create our first repository:

The plug in panel provides details on which commands you need to run to do this, but does not tell you how to run them. This is where Secure Shell comes in.

1. Run Putty.

2. In the ‘Host’ field, enter the IP address or name of your NAS server.

3. Ensure that the connection type is ‘SSH’.

4, Click the ‘Open’ button.

5. A command prompt like window will open and you will be prompted to enter a username and password. Enter ‘root’ as the username and the admin password for your NAS server as the password.

6. Create the repository using the command:

svnadmin create /opt/subversion/<name of your new repo>

7. Change the owner of the subversion files to ‘admin’ using the command (The previous command will have created the files as the ‘root’ user:

chown -R admin:admin /opt/subversion/*

8. Disable repository sharing with the following command:

echo ‘enable-rep-sharing = false’ >> /opt/subversion/<name of your new repo>/db/fsfs.conf

This last part is needed because of a bug in the version of SQlite shipping with the ReadyNAS

if you’ve set up WebSVN you should see your new repository listed at the url:

http://<ip address of your nas or server name>/websvn

Create further repositories with WebSVN

To create further repositories you can do this via WebSVN simply by entering the name of the repository you wish to create in the ‘Create New Repository:’ field and clicking the ‘Go’ button, but before you do so, read on!

Important: You won’t be able to view the repository list in WebSVN if there are no repositories set up; you’ll get an error message. The first repository must be set up using the secure shell method described above.

Migrate data from existing repositories

If like me, you’ve been using subversion elsewhere, you’ll need to get the data from your existing repositories migrated over.

You can use svnadmin dump and svnadmin load to do this.

Important: svnadmin load will fail if you try to load data into a repository that is not empty.

Important: WebSVN automatically creates the standard subversion trunk, branches and tags folders. Therefore you can’t load data into a repository created by WebSVN; you’ll need to use the SSH method of creating a repository described above to create a repository if you want to migrate data into it.

To export your data:

1. Open the command prompt and cd to the folder containing your subversion repositories

2. Execute the following command:

svnadmin dump <name-of-repository> > <name-of-repository>.dump

For example: svnadmin dump test > test.dump

To import your data

1. copy the .dump file to a share on your NAS server (I used the backups share)

2. Open a SSH session with putty and log in as root.

3. Execute the following command:

svnadmin load –quiet /opt/subversion/<name-of-repositoy> < /backups/<name-of-repository>.dump

For example: svnadmin load –quiet /opt/subversion/test < test.dump

4. Check that you can browse the repository in WebSVN.

And Finally

1. You’ll need to perform a svn relocate on your working copies. TortoiseSVN has a menu item to do this if you don’t want to use the command line. The Eclipse subversion plugin, Subclipse also provides a relocate function in the repository exploring view.

Alternatively, you can delete your working copy and check it out from the new location, if you have no local changes.

2. User access to subversion, by default is open to all users with a share on the NAS server. I’ve no idea how to change this; that will need to wait for a future blog. If you haven’t set up user shares, then you should at least set up one for yourself; you don’t want to commit as admin all the time, especially if these are multi user repositories.

Written by pedrocadiz13

24/07/2011 at 6:29 pm

Posted in Computing