Backup Linux systems using BackupPC

This article is going to take you through on how to Backup Linux systems using BackupPC. BackupPC is a completely free web-based disk-to-disk backup software bundle. The cross-platform server can run on any Linux, Solaris, or UNIX-based server.

Check out our article on how to install BackupPC

How to Backup Linux systems using BackupPC

In order to backup Linux systems using BackupPC;

Add Linux Hosts to BackupPC server

  • Start by signing in to BackupPC.
  • On the dashboard click on Edit Hosts as shown below;
  • Next click Add and enter your remote client IP and the backup user;
  • Then click Save button to apply changes as shown below.

Define the Paths and Directories to Backup

  • Next, click on Host Summary or any menu option to refresh the page.
  • Select the host from the Hosts drop down;
Backup Linux systems using BackupPC
  • When selected, click Edit Config to update the host backup settings;
Backup Linux systems using BackupPC
  • After that click Xfer tab to set up backup data transfer protocol, in this example we are going to use rsync protocol. On the XferMethod, click and select rsync on the drop menu that will appear as shown below and then click save button to apply changes.
  • The next step is to specify the directory path for the client system you want to backup. Under Rsync Settings > RsyncShareName and define the paths to backup.
  • Note, you can include/exclude some files from being backed up by entering the file names under Include/Exclude option.
  • Under Rsync Paths/Commands/Args settings, ensure the path of rsync command on the client is correct. also ensure the username is correct, $sshPath -l backuppc.
  • You can also update the schedule to define how backup for the specific client is done. To do so, go to the schedule tab and set your desired backup settings as shown below then click save button to apply changes.
Backup Linux systems using BackupPC

Create Backup User on the Remote Host

On the host transfer settings above, we configured backuppc user as backup user on the remote client.

You need to ensure that this user account is available.

On Linux systems, if the account is not already there, create the account as follows;

useradd -m -s /bin/bash backuppc
passwd backuppc

Install Rsync on the Remote Host

Since we are using Rsync protocol, you need to ensure that Rsync command is installed on the remote host to backup.

If you are running an Ubuntu, install it as follows;

apt install rsync

CentOS and similar distros;

yum install rsync

Refer to other distros documentation on how to install Rsync.

Configure Backup User to Run Rsync with SUDO rights on Remote Host

In order to ensure that the Backup user has rights to copy the files/data that is being backed up, you need to allow it to run the backup command, rsync with passwordless sudo;

echo "backuppc ALL = NOPASSWD: $(which rsync)" > /etc/sudoers.d/backuppc
chmod 0440 /etc/sudoers.d/backuppc

Check sudoers file for syntax issues;

visudo -f /etc/sudoers.d/backuppc -c

Copy Backup User SSH Keys to Remote Host

Since we are using Rsync protocol for backup, you need to ensure that the Backup server can seamlessly login to remote host and initiate backup.

In the previous guide to setup BackupPC server, we already generated SSH keys as BackupPC user;

Thus, you just need to copy the keys;

NOTE: The command is run on the Backup Server;

su - backuppc
ssh-copy-id back-user@remote-ip/hostname

For example;

ssh-copy-id [email protected]

Sample output;

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/backuppc/.ssh/id_rsa.pub"
The authenticity of host '192.168.58.38 (192.168.58.38)' can't be established.
ED25519 key fingerprint is SHA256:Yxu3SH4Morp/4N4KdtOW/tW4x5aJimoRM9D4aaM0jNU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

Test the connection to ensure you can connect to remote host by running the ssh command (ssh ‘[email protected]) as backuppc.

Backup Linux systems using BackupPC

  • Next, login back to BackupPC UI, select the host and start full backup.
Backup Linux systems using BackupPC
  • If everything went well, reply from the server should be OK.
  • You can also check the logs by Clicking on the LOG file to view backup logs.
Backup Linux systems using BackupPC
  • Finally click on browse backup to check backed up content.
Backup Linux systems using BackupPC
  • Host Summary;
Backup Linux systems using BackupPC

Congratulations, you’ve made it to the end of the article. You have learned how to Backup Linux systems using BackupPC.

Read more on BackupPC Documentation

Other Tutorials

Configure Syslog Server on Rocky Linux 8

Configure Syslog Server on Debian 11

Configure Syslog Server on Ubuntu 22.04

System administrator | Software Developer | DevOps

Leave a Comment