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

My Home Server

by Lasse Soelberg 14. May 2009 21:40

As like many other Computer Science persons, i have my own server running at home. I use it primarily as an svn server and to do backup of various things. Being a student, one of the demands I had for server was that it was cheap to run, such that my electrical bill wouldn’t be too insane. After some researching into the matter i discovered the perfect little device: the Linksys NSLU2

The Slug

The NSLU2 is nicknamed Slug. It contains a 266 MHz ARM processor, 32 MB RAM and 8 MB Flash ROM. Being small the only connectors on it are 2 USB ports, an ethernet port and the power. A nice feature of the device is that it is passively cooled, so it is dead quiet Laughing. The OS on the slug is a custom made version of Linux.

           nslu2                           250px-NSLU2_board_front

 

Modding

Being a Linuc device, there are some nifty people that have managed to replace the firmware on the slug with their own version, making it capable to do a lot more than it was designed to. A good source for information regarding what you can do with a slug is http://www.nslu2-linux.org/.

By changing the firmware it is possible to install the OS on an external disk, making it possible to install a lot more programs on it than can be kept in the 8 MB onboard flash. My first attempt was with Unslung, which is a good starting point, since it only extends the original firmware and still keeps the interface from the original. After a while though, i decided to change it to Debian to get the power of a full linux distro.

My Setup

My Slug runs Debian 5.0, which there is a nice installation guide for here, from a 30 GB external 2.5” harddrive. I have set up ssh with key authentication on it, which is my primary means of interacting with it. I also have Sambato make a little network drive. I have subversion installed for having my own versioning control system. I also have some backup solutions running that stores the backup on Amazon S3, i will describe those setups in other blog posts.

Tags: , ,

NSLU2

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen