SVN Repository Backup

by Lasse Soelberg 17. May 2009 11:44

This is how I solved my first backup task. An overview of my backup project is found here.

The task is to make incremental backup’s of my subversion repository and store the backup on Amazon S3. I found a blog post by Damon Timm describing how to do incremental backups to S3 using a piece of software called Duplicity. Damon’s is based on OS X or Ubuntu, so it is quite similar to my install, since my server runs Debian. There are a few differences however, such as no sudo command and i had to generate the gpg key on another machine.

Installation of the software

First thing first. Log in as root and issue an apt-get update:

su root
apt-get update

Time to install Duplicity. The latest version at time I installed the software was 0.5.16. Check Duplicity’s download page to see if there has been a new version made available:

apt-get build-dep duplicity
aptitude install python-boto ncftp
wget http://savannah.nongnu.org/download/duplicity/duplicity-0.5.16.tar.gz
tar xvzf duplicity-0.5.16.tar.gz
cd duplicity-0.5.16/
python setup.py install

We also need a piece of software called s3cmd, so that is installed next

apt-get install s3cmd

Encryption

As mentioned earlier i couldn’t get the server to generate a new key for me. It just kept hanging with a message that it needed more entropy. To overcome this problem i generated the key on a different machine, exported it, imported it to the server and changed the trust, so I could use it.

Generate and export the key

I booted Ubuntu 9.04 from a Live CD and once logged in I generated the key with the default choices:

gpg --gen-key

To export the key run the following command, substituting NAME with the name from the key and FILE with the file to save the key in.

gpg -a --export-secret-keys NAME > FILE

Import the key

After copying the key to the server, it is loaded with the following command,  substituting  FILE as described above.

gpg --allow-secret-key-import --import FILE

Next is to change the trust level on the key, otherwise Duplicity will complain and quit, rendering encrypted use of Duplicity useless. Substitute NAME with the name from the key.

gpg --edit-key NAME

This will put you in a console. Type “trust” and choose 5, I trust ultimately. After the trust have been set, you leave the console again by typing “quit”.

Passphrase

The last thing to consider is the passphrase used for the key. I have my key stored in a file that has been chmod’ed to 0600.

nano ~/.gnupg/.gpg-passphrase

Enter the passphrase and press Ctrl^O to save and then Ctrl^X to exit. Finally the rights on the file has to be modified.

chmod 0600 ~/.gnupg/.gpg-passphrase

The Script

Now that all the software bits have been set up, it is time to make a script that can take care of the backup procedure. And that script is described here .

Tags: , , , ,

Backup | NSLU2

Comments

5/27/2010 10:20:09 AM #

wholesale air max


I just want to say I like it and thanks.

wholesale air max United States |

5/27/2010 10:21:12 AM #

wholesale air max

Always good to see, this was  a brilliant post. In theory I would like to write like this too. You need time to creat that interesting and additionally real effort to make such a good article.

wholesale air max United States |

5/31/2010 1:31:09 AM #

Randal Serravalli

I fully go along with the above mentioned remark, the internet is undoubtedly expanding into the most essential channel of communication internationally and it's because of places like this that ideas are spreading so quickly.

Randal Serravalli United States |

6/5/2010 12:14:50 AM #

Tina

Anybody tried the newest Ubuntu release? I'm running Karmic right now, trying to get an idea if I should update this thing.

Tina United States |

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen