Backup up on Debian with Duply and Duplicity
Ronald MacDonald <email@example.com> v1.0, Wed Aug 3 20:05:33 IST 2011
Backing up data is a total chore and is something I never enjoy doing. It is, however, absolutely necessary and critical for your own peace of mind, if anything else.
Many backup solutions exist - some of which are very versatile, some others which make many of the configuration choices for you automatically. One example is Apple’s Time Machine - you simply plug a drive in, click enable to allow backup to a particular drive and then sit and wait. Lost a file? It’ll swoosh a fancy gimmicky screen in front of you and you can pick up the file from three months ago, from where you left off.
On the other extreme is something like Amanda’s backup manager. You’re in complete control and as such are expected to specify your critical directory paths and irreplaceable config files in a file to as to include them in the backup. No funny business, no backing up files you’ve long since forgotten or care about, simply a straightforward copy and archive onto a secure backend.
The solution described in this short article sits somewhere between the two. Granted, it’s not quite as straightforward as just a Plug n Play job like Apple’s, but you should eventually find the system refreshingly simple and easy to use. Step forward, Duplicity and Duply!
The following assumptions are made:
- You’re backing up to a remote, insecure location and hence require your backups to be securely encrypted
- You’re making a small number of full backups a month, as well as more regular incremental backups
- You’re the administrator and have full access to the server
- You’re running Debian (Lenny) - other users should, however, be able to follow (just use some common sense)
Download and Install
Debian’s archives are woefully out of date and so rather than crying about it, let’s grab the source archives and install ourselves a beautiful, new, up-to-date version from the Duplicity home page.
There are two ways of doing this. The cleanest way is to create a .deb Debian package, which will keep track of all changes that the installation makes to your system. Simply doing a
dpkg --remove <packagename> will get rid of any unwanted installation files, if you change your mind further down the road. The second way is to do it the traditional way, skipping the .deb voodoo.
You’ll need the usual tools for making .debs, so this step’s important:
apt-get install dh-make debhelper devscripts build-essential checkinstall
Let’s get the package downloaded, configured and built.
mkdir -p ~/src && cd ~/src wget <url> tar -zxvf <packagename>.tar.gz ./configure make sudo checkinstall -d make install sudo dpkg -i <newpackagename>.deb
No .deb creation/Normal Install
As before, except we’re not needing the checkinstall step, so it’s pretty similar to what was above:
mkdir -p ~/src && cd ~/src wget <url> tar -zxvf <packagename>.tar.gz ./configure make sudo make install
Any errors popping up are, most likely, due to dependency issues. Therefore rather than panicking, try have a look at the first ‘error’ message appears and see if you can do a quick search of the apt archives for libraries (usually shortened to ‘lib’). I’m happy to give you a hand if you email me with whichever error appears.
Duply is only one script and requires Python to run.
Download Duply from http://duply.net/ and put it somewhere sensible, such as
wget "http://downloads.sourceforge.net/project/ftplicity/duply%20%28simple%20duplicity%29/1.5.x/duply_184.108.40.206.tgz" tar -zxvf duply_220.127.116.11.tgz && cd duply_18.104.22.168 chmod +x duply su OR sudo bash cp duply /usr/bin/duply
Good. Now, it’s in the path - but of course bash won’t pick up on this `til you open a new session. So let’s do that before we continue!
Duply’s configuration is stored in a single file per backup ‘regime’ or ‘profile’, which is initially created as follows:
[as root]# duply <name> create
For example, I’ve a profile called ‘global’ which, as might be expected, backs up all the data on the server every night.
To create this profile:
[as root]# duply global create
Now, all your global configuration sits in /root/.