December 7, 2024

BackupPC

BackupPC is a (usually linux/BSD based) server based backup application that can backup Windows, Mac and Linux laptops/desktops to a single server and, importantly, de-duplicate files, so if you have duplicates of the same file on a couple computers, it will only backup one, so your backups are a lot smaller. You can browse and restore your files with a web browser, and also it stores your files in standard system files (unlike Bacula, another popular backup app), so you can always get them back if your server app installation becomes screwed somehow, of if you find the backup server hard drive laying around and just want to load files from it.

Install

Installing BackupPC is easy, understanding its configuration is nuts, you have to understand what it’s trying to do before you can get a clear picture of how to make it do what you want. On the SERVER do:

apt-get install backuppc

Now figure out where you want to put all your backup files for all your different laptops, and what method you’ll use to transfer them, in this example I’m using rsync. Change the oddball path below to where you want to put all your backups. Make sure that has enough space for them all:

su backuppc
vi /etc/backuppc/config.pl
    $Conf{XferMethod} = 'rsync';
    $Conf{TopDir}     = '/path/to/where/you/want/to/put/yourbackupfiles';

Now you have to create a local file on the backuppc server to tell backuppc how to back up your remote box:

su backuppc
vi /etc/backuppc/remotehost.pl
    #
    $Conf{XferMethod} = 'rsync';
    #$Conf{FullPeriod} = 6.97;
    #$Conf{IncrPeriod} = 0.97;
    # Number of full and incremental backups to keep:
    #$Conf{FullKeepCnt} = 2;
    #$Conf{IncrKeepCnt} = 6;
    $Conf{RsyncShareName} = '/';
    # These files/paths will be excluded from the backup:
    $Conf{BackupFilesExclude} = ['/proc', '/dev', '/cdrom', '/media', '/floppy', '/mnt', '/var/lib/backuppc', '/lost+found'];
    # Level of verbosity in Xfer log files:
    $Conf{XferLogLevel} = 1;

Now add an entry into your hosts file to point backuppc to the right remote IP:

vi /etc/hosts
    1.2.3.4    remotehost

Now add an entry to the end of the backuppc host.pl file so it knows to go looking for a host named remotehost to backup:

su backuppc
vi /etc/backuppc/hosts
    remotehost   0       backuppc        root

Now you have to create a connection from Backuppc –> root on the box you want to back up. In order to do this, you have to allow root login on the remote box, which you do by adding these lines on REMOTE server

vi /etc/ssh/sshd_config
    PermitRootLogin yes
    AllowUsers root@your.backuppc.server.ip
/etc/init.d/ssh restart

now set up a password-less remote login from back on your BACKUPPC server, so log back into that box as root and do:

su backuppc
ssh-keygen -t dsa -f ~/.ssh/id_dsa -C "backuppc@backup.pc.i.p"
cat ~/.ssh/id_dsa.pub | ssh root@server.ip.tobackup.up 'cat - >> ~/.ssh/authorized_keys'

if this worked, you should be able to ssh directly to root on your remote box like

ssh root@server.ip.toback.up

and it shouldn’t prompt you for a password

Troubleshooting

The most common thing backuppc does when it fails to back some computer up is give very vague reasons. You can manually force it to attempt a backup on a single computer by doing this on your backuppc SERVER:

su backuppc
/usr/share/backuppc/bin/BackupPC_dump -v -f ip.of.remote.computer

How to logout: it seems like this would be easy, but it’s not obvious, you have to prepend another username to the URL, it will trigger a new authentication without losing all your other current sessions

https://somehost.com/backuppc => https://someuser@somehost.com/backuppc

Errors:

error what it means
CheckHostAlive: returning 0.587
Backup aborted ()
Can’t call method “getStats” on an undefined value at
./BackupPC_dump line 1143.
working on it…

Leave a Reply