How to set up a cross-platform backup server on Linux with BackupPC

Just in case you haven't been able to tell from my earlier posts on backupninja and backup-manager, I am a big backup fan. When it comes to backup, I'd rather have too much than not enough, because if the need arises, you will be grateful that you took the time and effort to generate extra copies of your important data.

In this post, I will introduce you to BackupPC, a cross-platform backup server software which can perform pull backup of Linux, Windows and MacOS client hosts over network. BackupPC adds a number of features that make managing backups an almost fun thing to do.

Features of BackupPC

BackupPC comes with a robust web interface that allows you to collect and manage backups of other remote client hosts in a centralized fashion. Using the web interface, you can examine logs and configuration files, start/cancel/schedule backups of other remote hosts, and visualize current status of backup tasks. You can also browse through archived files and restore individual files or entire jobs from backup archives very easily. To restore individual single files, you can download them from any previous backup directly from the web interface. As if this weren't enough, no special client-side software is needed for client hosts. On Windows clients, the native SMB protocol is used, whereas on *nix clients, you will use rsync or tar over SSH, RSH or NFS.

Installing BackupPC

On Debian, Ubuntu and their derivatives, run the following command.

# aptitude install backuppc

On Fedora, use yum command. Note the case sensitive package name.

# yum install BackupPC

On CentOS/RHEL 6, first enable EPEL repository. On CentOS/RHEL 7, enable Nux Dextop repository instead. Then go ahead with yum command:

# yum install BackupPC

As usual, both package management systems will take care of dependency resolution automatically. In addition, as part of the installation process, you may be asked to configure, or reconfigure the web server that will be used for the graphical user interface. The following screenshot is from a Debian system:

Select your choice by pressing the space bar, and then move to Ok with the tab key and hit ENTER.

You will then be presented with the following screen informing you that an administrative user account 'backuppc', along with its corresponding password (which can be changed later if desired), has been created to manage BackupPC. Note that both a HTTP user account and a regular Linux account of the same name 'backuppc' will be created with an identical password. The former is needed to access BackupPC's protected web interface, while the latter is needed to perform backup using rsync over SSH.

You can change the default password for the HTTP user 'backuppc' with the following command:

# htpasswd /path/to/hash/file backuppc

As for a regular 'backuppc' Linux user account, use passwd command to change its default password.

# passwd backuppc

Note that the installation process creates the web and the program's configuration files automatically.

Launching BackupPC and Configuring Backups

To start, open a browser window and point to http://<server's FQDN or IP address>/backuppc/. When prompted, enter the default HTTP user credentials that were supplied to you earlier. If the authentication succeeds, you will be taken to the main page of the web interface.

Most likely the first thing that you will want to do is add a new client host to back up. Go to "Edit Hosts" in the Task pane. We will add two client hosts:

  • Host #1: CentOS 7 [IP 192.168.0.17]
  • Host #2: Windows 7 [IP 192.168.0.103]

We will back up the CentOS host using rsync over SSH and the Windows host using SMB. Prior to performing the backup, we need to set up key-based authentication to our CentOS host and a shared folder in our Windows machine.

Here are the instructions for setting up key-based authentication for a remote CentOS host. We create the 'backuppc' user's RSA key pair, and transfer its public key to the root account of the CentOS host.

# usermod -s /bin/bash backuppc
# su - backuppc
# ssh-keygen -t rsa
# ssh-copy-id root@192.168.0.17

When prompted, type yes and enter root's password for 192.168.0.17.

You will need root access for a remote CentOS host to grant write access to all its file system in case of restoring a backup of files or directories owned by root.

Once the CentOS and Windows hosts are ready, add them to BackupPC using the web interface:

The next step consists of modifying each host's backup settings:

The following image shows the configuration for the backup of the Windows machine:

And the following screenshot shows the settings for the backup of the CentOS box:

Starting a Backup

To start each backup, go to each host's settings, and then click "Start Full Backup":

At any time, you can view the status of the process by clicking on the host's home as shown in the image above. If it fails for some reason, a link to a page with the error message(s) will appear in the host menu as well. When a backup completes successfully, a directory with the host's name or IP address is created under /var/lib/backuppc/pc in the server:

Feel free to browse those directories for the files from the command line, but there is an easier way to look for those files and restore them.

Restoring Backup

To view the files that have been saved, go to "Browse backups" under each host's main menu. You can visualize the directories and files at a glance, and select those that you want to restore. Alternatively, you can click on files to open them with the default program, or right click and choose Save link as to download it to the machine where you're working at the time:

If you want, you can download a zip or tar file containing the backup's contents:

or just restore the file(s):

Conclusion

There is a saying that goes, "the simpler, the better", and that is just what BackupPC has to offer. In BackupPC, you will not only find a backup tool but also a very versatile interface to manage your backups of several operating systems without needing any client-side application. I believe that's more than reason enough for you to give it at least a try.

Feel free to leave your comments and questions, if you have any, using the form below. I am always happy to hear what readers have to say!

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. When he's not typing commands or writing code or articles, he enjoys telling bedtime stories with his wife to his two little daughters and playing with them, the great pleasure of his life.

16 thoughts on “How to set up a cross-platform backup server on Linux with BackupPC

    • @Antoine,
      I am not sure what you mean by "bare metal restore". But if your question is whether you can use backuppc to take and restore backups from both Linux and Windows, the answer is yes. Please clarify your question if this is not the answer you were expecting. Thanks.

  1. Will this work on NAS devices?
    I have a Buffalo NAS with shares that I would like to backup occasionally. Right now I have a very dirty shell script that completes a CIFS mount to a Windows server where my tape library is connected to complete a RSYNC from a Linux server. If I could use this method instead, it would be brilliant.

    • @Ed,
      I haven't tested this on NAS devices, but I don't see a reason why it would not work - the absence of a client-side installation basically guarantees that any storage device (of whatever kind) is seen by backuppc as a black box.
      Let me know if you run into any issues.

    • Yes, this will work with a NAS. I have a Buffalo NAS as well and I mount the NAS shared folder to the Linux Host via CIFS. Then you can tell BackupPC to use that mount (Your Buffalo NAS mount)

  2. Hello Mr. Canepa,

    Some info about BackupPC:

    1. Advantages:
    - very good web interface;
    - versatile, with many options (for example you can create ISO images from your backups);
    - it has some kind of file de-duplications (good if you want to save space);
    - and for sure a lots of other useful options (retention period is also a good option)

    2. Disadvantages:
    - very slow web-interface if you have a lots of backups (let say 10 PCs, with 10-20 GB each backup) and you want to restore 15 GB of data;
    - it does not scale very well in case of a big data volume
    - the backup speed is slow, especially if you have lots of files
    - the syntax used in config files is complicated, so it is very easy to make mistakes

  3. @Iulian,
    Thank you so much for your very informative comment, as usual :).
    Let me address the disadvantages that you have pointed out:
    If someone needs to backup 10+ machines with that amount of data (10-20 GB), IMHO a dedicated professional backup appliance would represent a better solution than a standalone server.
    In addition, backup speeds not only depend on the software solution (backuppc in this case), but also on the network structure where the backuppc server and the machines are placed. Have you tried several setups with the same results? (slow backups for big files)
    I admit that the syntax of the configuration files can be a little tricky to understand at first (config.pl follows a perl-like structure), but it is extremely well documented in the project's web site (http://backuppc.sourceforge.net/).
    Again, thanks for raising your concerns and for sharing the advantages of this great tool.
    Best regards.

  4. Hello again Mr. Canepa,

    I forget to mention that your tutorial is very good, as usual - mea culpa for this. From my own experience with this good tool (used in the right place):
    - I used it in the past for 3-4 years
    - the problems arise when the files numbers was > 4-5.000.000 - the speed of network was ok (Gbit, with 7-800 mbits/sec on big files)
    - but 70% of my files were small < 10 MB - also a small amount of these files change their content < 2 % - at the end my backuppc used around 4-5 hours to finish - now on the same network, on the same server but with 7-8.000.000 files and a double data volume (3-400 GB) with rsync, the same job is finished in 1-2 hours - also I need to mention that my backup server has now this on it: zfs (compared with ext3 and lvm in the backuppc period) and a doubled ram size (8 GB now) - I also must mention (for anyone who is interested) that from my point of view, any "professional" solution should be a mix of software and hardware which has the desired/wanted results - and to cite a former chinese leader, "it is not important what is the color of the cat, but is important if the cat can catch/hunt the mouse" -sorry for my bad english. In romanian language, it will be (I hope you will understand this): "Nu conteaza ce culoare are pisica, important este daca poate prinde soareci"

    • First off:

      Mr. Canepa: Thank you very much for the well written and detailed descriptions. Kudos.

      Mr. Murgulet: Thank you for the articulate and useful commentary. Again, Kudos

      To Mr Murgulet:

      Can you post a similar article on your architecture/topology and your rsync configuration for performing backups?

      Again, thanks again to you both!

  5. A bare metal restore means a full restore of the OS from scratch, let's say on a new disks or server (assuming we keep or not same NICS and HBA cards). Useful when disaster strikes hard.

  6. @Antoine,
    To be honest, I haven't tried that - but I don't see a reason why it would not work. Sounds like a fun weekend project! Backuppc is one of the most complete backup tools out there, hands down.

  7. Hi,

    I followed the instructions to install in CentOS7 but after the download and install, BackupPC Configurator doesn't start automatically, do you have any tips to start configurator manually?

    Thank you!

    • @rogercwb,
      You're right, CentOS does not bring up configuration screens as Debian and derivatives do. I wrote this article using a Debian VM, to which I do not have access right now. I did not install BackupPC in my CentOS VM, but you should start looking for the configuration files (which are edited by the configuration screen) inside /etc/backuppc or something like that.

  8. I was fascinated to find an article that has been tagged for CentOS 7 and discover that the first graphic is an image of a Debian system. Both quality distros that are NOT related to each other. Two completely different development groups. The gall . . . to think that you could write an article about how to do an installation on CentOS 7 (which is clearly inaccurate) and then use images that are a Debian system related . . . I will make sure and NOT read any articles on "xmodule.com" and/or authored by Gabriel Canepa. They cannot be factual if the author clearly does not know what you are writing about . . . I wonder how many other readers have come to the same conclusion and stopped reading your stuff.

    • Well, you are being harsh. Clearly Gabriel tested the setup on Debian, but also showed that it's available on RPM repositories (so the tutorial can be a useful starting point for those CentOS/RHEL users as well). Granted there may be some gory details where CentOS7 might differ during configuration, but please learn to acknowledge the time and effort put into the tutorial for the community. The least you could do is to raise any issue encountered in CentOS 7, so the tutorial can be corrected for others to benefit. Don't be spoiled.

Leave a comment

Your email address will not be published. Required fields are marked *