Back Up Linux And Windows Systems With BackupPC - Page 3

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2007-01-25 14:39. ::

4 The BackupPC Configuration Files

BackupPC's configuration files are in the /etc/backuppc directory. The most important ones are /etc/backuppc/config.pl and /etc/backuppc/hosts. You should open them now to become familiar with all configuration options. Both files are heavily commented, so by reading them you should understand what they do. For example, in /etc/backuppc/config.pl you can define how often and when BackupPC wakes up to back up the clients, when/how often it does full or incremental backups, how many log files it should keep, etc.

server1.example.com:

vi /etc/backuppc/config.pl

vi /etc/backuppc/hosts

Don't modify them now - most default values are ok to get started.

 

5 Add The Ubuntu System falko-desktop As A Backup Client

To add a client to BackupPC, we must add it to /etc/backuppc/hosts. That file has the following format:

host        dhcp    user      moreUsers
hostname1     0     user1     anotheruser,athirduser
hostname1     1     user2     stillanotheruser

The first column contains the hostname/NetBIOS name of the client (e.g. falko-desktop), the second column whether the client is configured through DHCP, the third column contains a user that is allowed to log into the BackupPC web interface to manage that backup client, and the fourth (optional) column contains additional users that can do the same.

Although falko-desktop is configured through DHCP, dhcp should only be set to 1 if the following tests fail:

server1.example.com:

nmblookup falko-desktop

If the test is successful, it should display falko-desktop's current IP address:

querying falko-desktop on 192.168.0.255
192.168.0.213 falko-desktop<00>

Now that you know falko-desktop's current IP address, run the same test in the other direction:

server1.example.com:

nmblookup -A 192.168.0.213

If successful, the output should look like this:

Looking up status of 192.168.0.213
        FALKO-DESKTOP   <00> -         B <ACTIVE>
        FALKO-DESKTOP   <03> -         B <ACTIVE>
        FALKO-DESKTOP   <20> -         B <ACTIVE>
        ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>
        MSHOME          <00> - <GROUP> B <ACTIVE>
        MSHOME          <1d> -         B <ACTIVE>
        MSHOME          <1e> - <GROUP> B <ACTIVE>

        MAC Address = 00-00-00-00-00-00

Both tests were successful, so we can set dhcp to 0, and we put falko-desktop   0       falko into /etc/backuppc/hosts and comment out the localhost line:

server1.example.com:

vi /etc/backuppc/hosts

[...]
falko-desktop   0       falko
#localhost   0       backuppc

If the tests had not been successful, we would have put falko-desktop   1       falko into /etc/backuppc/hosts instead, and in addition to that we would have had to change the variable $Conf{DHCPAddressRanges} in /etc/backuppc/config.pl.

We have added the user falko to the hosts file. That's the system user whom BackupPC will send email reports regarding falko-desktop, so we should create that user on the BackupPC server now:

server1.example.com:

useradd -m falko
passwd falko

In addition to that we must create a password for falko for the BackupPC web interface:

server1.example.com:

htpasswd /etc/backuppc/htpasswd falko

(If you like you can now open a second browser and log in as falko on http://192.168.0.100/backuppc/.)

Now we must edit /etc/backuppc/config.pl. The backup method for falko-desktop will be rsync, so we set $Conf{XferMethod} = 'rsync';.
falko-desktop has just one (big) partition (/), so we set $Conf{RsyncShareName} = '/';. If you have multiple partitions to backup, you'd specify something like $Conf{RsyncShareName} = ['/', '/var', '/data', '/boot']; instead.

rsync will be tunneled through SSH (port 22). SSH needs to know the hostname or IP address of the client. Unless you have a DNS server that resolves falko-desktop to its IP address, SSH will not be able to resolve the name falko-desktop. Therefore we replace $host with $hostIP in $Conf{RsyncClientCmd} and $Conf{RsyncClientRestoreCmd}.

server1.example.com:

vi /etc/backuppc/config.pl

[...]
$Conf{XferMethod} = 'rsync';

$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+';
$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+';
$Conf{RsyncShareName} = '/';
#$Conf{RsyncShareName} = ['/', '/var', '/data', '/boot'];
[...]

(You might wonder now how we can specify options for multiple clients because the options for notebook will be different from those for falko-desktop. It works like this: the options in /etc/backuppc/config.pl are global values that are valid for all clients unless they have their onw configuration file in /etc/backuppc, named after their hostname. So for notebook we will create /etc/backuppc/notebook.pl, and it will contain only the values that are different from the ones in /etc/backuppc/config.pl. In fact, we could have created /etc/backuppc/falko-desktop.pl for falko-desktop instead of modifying /etc/backuppc/config.pl.)

Next restart BackupPC:

server1.example.com:

/etc/init.d/backuppc restart


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.