Table of Contents

Install BackupPC

BackupPC is a very powerful backup system run on the server machine. You find all the necessary documentation on http://backuppc.sourceforge.net, including configuration instructions.

Installation

apt-get install backuppc

Take a note of the pre-assigned password <pwd> during the run of the installation script

Changing Password

Creating or initializing the password file:

htpasswd -c /etc/backuppc/htpasswd backuppc

Adding users to backuppc to access the CGI interface:

htpasswd /etc/backuppc/htpasswd <user>

To disable authentication, comment the auth instructions in /etc/backuppc/apache.conf and restart backuppc and apache.

Main Configuration

If you do not install BackupPC on a machine which's sole purpose is to backup data, you should move the target data space to a separate mount point or even a separate harddisk.

cd /var/lib
mv backuppc /backup  # move the content as set up by the installer to a separate mount point, e.g. /backup
ln -s /backup/backuppc backuppc  # create a symlink so all the default paths are maintained

:!: If you install and run BackupPC on a machine with Gnome desktop running, you need to exclude ~/.gvfs from the backup path to avoid the task aborting when trying to access the path (see config file below) :!:

Details how to setup clients for backup are found in the documentation. Following are example config files and some hints for different types of clients.

Find important global settings which differ from the default below.

Global config: config.pl

# Global config
# run nightly cleanup at 3am, run backups between 4am and 4pm and at 9pm
$Conf{WakeupSchedule} = [3..16, 21];

# Smbclient share user name.  This is passed to smbclient's -U argument.
$Conf{SmbShareUserName} = '<smb_user>';
$Conf{SmbSharePasswd} = '<pwd>';

# Minimum period of 7 days between full and incremental backups
$Conf{FullPeriod} = 6.97;
$Conf{IncrPeriod} = 0.97;

# Remove full backups after <FullAgeMax> days but keep at least <FullKeepCntMin>
$Conf{FullKeepCntMin} = 1;
$Conf{FullAgeMax}     = 90;

# Keep <IncrKeepCnt> incremental backups
$Conf{IncrKeepCnt} = 30;

# Remove full backups after <IncrAgeMax> days but keep at least <IncrKeepCntMin>
$Conf{IncrKeepCntMin} = 3;
$Conf{IncrAgeMax}     = 30;

# For clients which are regularly online specify blackout periods
# when no backups will be started
$Conf{BlackoutPeriods} = [
    { # weekdays
      hourBegin =>  9.0,
      hourEnd   => 23.0,
      weekDays  => [1, 2, 3, 4, 5],
    },
    { # weekend
      hourBegin => 12.0,
      hourEnd   => 23.0,
      weekDays  => [0, 6],
    },
];

# Only increase the ping time if you need to access a client outside your LAN
$Conf{PingMaxMsec} = 20;

Configuration for Windows clients

all Windows

$Conf{SmbShareUserName} = 'VENUS/panther';
smbclient '//clientname/C$' -U username

Windows XP

Windows 7

Turn on network discovery
Turn on file and print sharing

Other settings can be left at their default.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
DWORD LocalAccountTokenFilterPolicy=1

Configuration scripts

gemini (localhost) - Ubuntu BackupPC server

Config: localhost.pl

# Gemini - BackupPC settings
#
$Conf{XferMethod} = 'tar';

$Conf{TarShareName} =  ['/etc', '/root', '/home', '/usr/local', '/var/www/', '/srv/share'];

$Conf{TarClientCmd} = '/usr/bin/env LC_ALL=C $tarPath -c -v -f - -C $shareName'
                    . ' --totals';

# remove extra shell escapes ($fileList+ etc.) that are
# needed for remote backups but may break local ones
$Conf{TarFullArgs} = '$fileList';
$Conf{TarIncrArgs} = '--newer=$incrDate $fileList';

# Files to exclude from backup
$Conf{BackupFilesExclude} = ['/tmp', '/temp', '/proc', '/mnt', '/dev', '/sys',
                             '/srv/media', '/srv/webcam', '/srv/share/_*', '/backup', '/var/vm',
                             '/home/<admin user>/.gvfs'];

To allow backuppc to backup all files on localhost, you need to either access the tar command through ssh, or use sudo:

$Conf{TarClientCmd} = '/usr/bin/sudo $tarPath -c -v -f - -C $shareName'
                        .' --totals';

visudo:

backuppc ALL = NOPASSWD: /bin/tar

titan - Windows XP Professional client

Config: titan.pl

# Titan - BackupPC settings
#
$Conf{XferMethod} = 'smb';

$Conf{SmbShareName} = ['C$', 'D$'];

$Conf{SmbShareUserName} = <XP_admin_user>;
$Conf{SmbSharePasswd} = <XP_admin_user's password>;

# Files to exclude from backup
$Conf{BackupFilesExclude} = {
      'C$' => ['/WINDOWS/temp', '/temp'],
      'D$' => ['/Capture', '/_*'],
      };

pluto - Windows XP Home Edition client

Config: pluto.pl

# Pluto - BackupPC settings
#
$Conf{XferMethod} = 'smb';

$Conf{SmbShareName} = ['System', 'Data'];

$Conf{SmbShareUserName} = <XP_admin_user>;
$Conf{SmbSharePasswd} = <XP_admin_user's password>;

# Files to exclude from backup
$Conf{BackupFilesExclude} = {
      'System' => ['/WINDOWS/temp', '/temp'],
      'Data' => ['/_*', '/iTunes', '/Download', '/TrueImage'],
      };

venus - Linux Ubuntu client

Other than for the local host (e.g. the server machine), rsync is much more efficient than tar to backup remote files. rsync communicates through an ssh connection with the client, which we first need to set up. Besides the instructions which you will find in the BackupPC documentation, the following needs to be considered:

apt-get install ssh rsync
sudo -u backuppc -s
ssh-keygen
admin   : /home/admin/.ssh
root    : /root/.ssh
backuppc: /var/lib/backuppc/.ssh  #which is /backup/backuppc/.ssh if you followed the guide above
root@gemini:~# cp ~/.ssh/id_rsa.pub /media/usb/admin.pub
root@gemini:~# cp /root/.ssh/id_rsa.pub /media/usb/root.pub
root@gemini:~# cp /var/lib/backuppc/.ssh /media/usb/backuppc.pub
root@venus:~# cat /media/usb/admin.pub >> ~/.ssh/authorized_keys
root@venus:~# cat /media/usb/root.pub >> /root/.ssh/authorized_keys
root@venus:~# cat /media/usb/backuppc.pub >> /root/.ssh/authorized_keys
# the last line is necessary to allow user "backuppc" to connect to the client as "root"
AllowUsers admin root
PermitRootLogin yes
from="gemini.condrau.com" ssh-rsa AAA...  # or
from="192.168.1.100" ssh-rsa AAA
ssh -p <portnum> venus
sudo -s
ssh -p <portnum> venus
sudo -u backuppc -s
ssh -p <portnum> -l root venus

Config: venus.pl

# Venus - BackupPC settings
#
$Conf{XferMethod} = 'rsync';

$Conf{RsyncClientCmd} = '$sshPath -p 50221 -q -x -l root $host $rsyncPath $argList';
$Conf{RsyncClientRestoreCmd} = '$sshPath -p 50221 -q -x -l root $host $rsyncPath $argList';

# Files to exclude from backup
$Conf{BackupFilesExclude} = ['/tmp', '/temp', '/proc', '/mnt', '/dev', '/sys', '/srv'];

Copy content of entire partition

rsync -avH /backup /mnt/new_backup/