TheDotProduct

Web-tech nerd stuff

Tutorial: Setting up BackupPC on Debian (and probably Ubuntu too) Linux

It’s been quite some time since I’ve had the pleasure of using BackupPC, a delightfully simple to use yet very effective, free, open source, cross-platform backup system. My test rig was sorely overdue some proper backups…So I decided to install BackupPC on a central server to back up the others (which are all Debian or Ubuntu).

I decided to use the excellent apt system to install, packages just make life easier so that means i kept it simple and put up with the ageing Apache web server (usually I opt for Nginx)…Here’s my brief tutorial by way of notes:

Install backuppc from the shell on the Debian/Ubuntu computer/server you want to be your backup server (assuming you’re root, if not, add “sudo ” before this):

apt-get update
apt-get install backuppc

This will install BackupPC and its dependencies (including apache) whilst also creating a unix user (“backuppc”) for the application to run under. Note that if you already have a web server or something else bound to port 80, Apache will fail to start – in this case please see appendix A below.

Note, you’ll be able to access the web-based admin interface of BackupPC via http://SERVER-IP/backuppc as standard. If you missed the password the installer gave you, see appendix B.

We’re not far off being done, the next step involves allowing your backup server to authenticate with each server/computer it will back up. I am making the huge assumption that these are *nix systems too, in which case proceed exactly as follows in this order (note that this does make several large assumptions but if you’re on a modern Debian or Ubuntu system, these should be valid):

On your backup server, su to the backuppc user:

su backuppc

Now (still as user backuppc) create an RSA keypair:

ssh-keygen -t rsa

Accept the default installation location (the home directory of the backuppc user) and leave the passphrase blank.

Next, you need to copy the public RSA key (id_rsa.pub) to the authorized_keys file for the root user of each of the servers/computers you want to back up (there are several ways to achieve this):

[COPY THE PUBLIC KEY]
ssh root@SERVER-IP
[ENTER PASSWORD]
cd
nano authorized_keys
[PASTE IN THE KEY AND SAVE THE FILE]

Now, since we’re on the server which is to be backed up, check that rsync is installed:

apt-get update
apt-get install rsync

Finally, check you can now SSH from the backup server to the server you want to back up as user backuppc:

su backuppc
ssh root@SERVER-~IP
[YOU WILL NEED TO ACCEPT THE ADDITION TO KNOWN_HOSTS THE FIRST TIME ONLY]

You should not need to enter a password, if you do something is wrong and you should see the troubleshooting wiki page. Make sure the permissions on your authorized_keys file are locked down to rw for root as owner only.

Ensure that you do SSH into each server/computer to backup

Simply repeat the above for each server/computer to backup the head over to your admin interface and configure…which is very simple – help links are integrated and there is plenty of help on the admin gui in the documentation.

So that’s it…I hope that helped, it’s kind of tricky to explain but the above should help you avoid most of the pitfalls of installing BackupPC on Debian or Ubuntu which I have encountered.

Cheers!

APPENDIX A

If apache failed to start due to something else on your server being bound to port 80, just edit /etc/apache/ports.conf and change the NameVirtualHost and Listen ports – I have varnish running on my server so i changed it to port 9999 like so:

NameVirtualHost *:9999
Listen 9999

(I left the rest of that file as it was) You could use any free port on your system. If apache didn’t start, you can do so now:

/etc/init.d/apache2 start

APPENDIX B

If you missed the password the BackupPC installer have you for the admin interface, the username is by default backuppc and you can reset the password (a standard htpasswd file) like so:

htpasswd /etc/backuppc/htpasswd backuppc
Created: Thu, 31 May 2012 10:00:00 GMT
Last modified: Thu, 31 May 2012 10:00:00 GMT