Install and Configure BackupPC on Rocky Linux 8

|
Last Updated:
|
|

In this guide, we are going learn how to install and configure BackupPC on Rocky Linux 8. BackupPC is a high-performance enterprise-grade backup software suite with a web-based frontend that can be used for backing up Linux, Windows and mac OSXs PCs and laptops to a server’s disk.

Some of the features of BackupPC include;

  • Provides a web interface which allows administrators to view log files, configuration, current status and allows users to initiate and cancel backups and browse and restore files from backups.
  • It supports Data deduplication: Identical files across multiple backups of the same or different PCs are stored only once resulting in substantial savings in disk storage and disk I/O.
  • It supports data Compression: Since only new files (not already pooled) need to be compressed, there is only a modest impact on CPU time.
  • It is Open-source: BackupPC is hosted on Github, and is distributed under a GPL license.
  • No client-side software is needed.

Read more about BackupPC features on About BackupPC page.

Installing BackupPC on Rocky Linux 8

Run System Update

Update your system packages.

dnf update

Install BackupPC on Rocky Linux 8

BackupPC 4 is available on EPEL repos. Therefore, install the EPEL repos on Rocky Linux 8 by running the command;

dnf install epel-release

EPEL repos provided BackupPC 4.3.2, which is the current stable release as of this writing.

dnf info backuppc

Available Packages
Name         : BackupPC
Version      : 4.4.0
Release      : 1.el8
Architecture : x86_64
Size         : 489 k
Source       : BackupPC-4.4.0-1.el8.src.rpm
Repository   : epel
Summary      : High-performance backup system
URL          : http://backuppc.github.io/backuppc/index.html
License      : GPLv2+
Description  : BackupPC is a high-performance, enterprise-grade system for backing up Linux
             : and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly
             : configurable and easy to install and maintain.
             : 
             : NOTE: Proper configuration is required after install, see README.setup for more
             : information.

Also, enable PowerTool Repos;

dnf config-manager --set-enabled powertools

You can simply install BackupPC and all its required dependencies by executing the command below;

dnf install -y backuppc

Configure BackupPC Server on Rocky Linux 8

Define BackupPC Backup Protocol

BackupPC supports different protocols to get backup data from devices being backed up:

  • smb – used for backing up windows machines
  • tar – used for backing up Linux/Unix/Mac OSX systems
  • rsync – used for backing up Linux/Unix/Mac OSX systems. This can also be used to backup Windows systems.

It also supports the use of ftp protocol. The use FTP is however not a recommended method of backup.

To define your preferred BackupPC backup protocol, open the BackupPC configuration file, /etc/BackupPC/config.pl and navigate to the section of the specific backup protocol you want to use.

vim /etc/BackupPC/config.pl

For instance, the Rsync{d} protocol configuration section begins at;

...
###########################################################################
# Rsync/Rsyncd Configuration
# (can be overwritten in the per-PC log file)
###########################################################################
...

and ends at where FTP configuration starts;

...
...
###########################################################################
# FTP Configuration
# (can be overwritten in the per-PC log file)
##########################################################################
...

To use rsync protocol for backup, ensure that rsync is installed on a client being backed up and that the correct path is defined for the parameter, $Conf{RsyncClientPath.

You can find the absolute path for rsync using which command.

which rsync
/usr/bin/rsync

Hence, the client path should be set like;

$Conf{RsyncClientPath} = "/usr/bin/rsync";

Also ensure that the backup transfer method, $Conf{XferMethod, for the client is set to rsync.

$Conf{XferMethod} = "rsync";

Define BackupPC Client Backup User

By default, BackupPC uses the root user on the backup clients for backup purposes.

$Conf{RsyncSshArgs} = ['-e', '$sshPath -l root'];

It is more secure to allow backup via a low-privileged user.

In this demo, we will create a non-privileged user, backuppc, on every client to backup which is only allowed to run rsync command with sudo rights for backup purposes. Therefore, change this user accordingly.

$Conf{RsyncSshArgs} = ['-e', '$sshPath -l backuppc'];

We will leave other Rsync settings with the default options. Note that all these are overwritable via the per-PC to be backed up configuration.

Configure BackupPC Administrative User

Default Administrative user for BackupPC is defined under CGI user interface configuration settings section. Normal users can only access information specific to their host. They can also start/stop/browse/restore backups. Administrative users have full access to all hosts, plus overall status and log information.

In this demo, we set the kifarunixadmin user as BackupPC admin.

$Conf{CgiAdminUsers}     = 'kifarunixadmin';

Change Backup Data Directory

By default, BackupPC writes backup data into /var/lib/BackupPC directory.

$Conf{TopDir}      = '/var/lib/BackupPC/';

Just in case you need to change the location where backup data is stored to an external hard drive for example, it is recommended that instead of changing TopDir path create a symbolic link to the new location, or mount the new BackupPC store at the existing $Conf{TopDir} path.

For example, assuming you have an empty drive, /dev/sdb1 as in our case, then you can simply mount it under, /var/lib/BackupPC/.

mount /dev/sdb1 /var/lib/BackupPC/

To automount on boot, update the /etc/fstab with the entry with the line below;

/dev/sdb1 /var/lib/BackupPC xfs defaults 1 2

Update the file-system accordingly.

Save and exit the file.

Configure BackupPC Apache Authentication

BackupPC uses Apache as the Web server by default and it is installed along with BackupPC itself. It also implements restricted access to the BackupPC web interface via Apache basic authentication.

Therefore, you can open BackupPC Apache configuration, /etc/httpd/conf.d/BackupPC.conf, which is created by default and make your preferred changes. For example, these are a few changes we made, AuthUserFile and AuthName.

vim /etc/httpd/conf.d/BackupPC.conf
...
AuthType Basic
AuthUserFile /etc/BackupPC/.backuppc
AuthName "Kifarunix BackupPC Restricted Access"

<IfModule mod_authz_core.c>
...

To allow external access to BackupPC, change the line, Require local to Require all granted.

...
<IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAll>
    Require valid-user
    <RequireAny>
      #Require local
      Require all granted
    </RequireAny>
  </RequireAll>
</IfModule>
...

Save and quit the configuration file.

Create the BackupPC authentication user and password and store them in the file specified by the value of the AuthUserFile parameter above.

For example, to create web authentication user called kifarunixadmin;

htpasswd -c /etc/BackupPC/.backuppc kifarunixadmin

You can add another user, say kifarunixuser.

htpasswd /etc/BackupPC/.backuppc kifarunixuser

Adjust the permissions of the auth user file;

chmod 666 /etc/BackupPC/.backuppc

Change the user under which Apache runs as from apache to backuppc and leave the group as apache;

vim /etc/httpd/conf/httpd.conf
...
User backuppc
Group apache
...

Disable Apache Welcome Page;

mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.old

Disable directory listing;

sed -i 's/Options Indexes FollowSymLinks/Options -Indexes +FollowSymLinks/' /etc/httpd/conf/httpd.conf

Check Apache for any errors;

httpd -t
Syntax OK

Start and enable Apache to run on system boot;

systemctl enable --now httpd

Running BackupPC

Once done with the configurations, start and enable BackupPC to run on system boot;

systemctl enable --now backuppc

To check the status;

systemctl status backuppc
● backuppc.service - BackupPC server
   Loaded: loaded (/usr/lib/systemd/system/backuppc.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-07-06 20:38:48 EAT; 4s ago
 Main PID: 20269 (BackupPC)
    Tasks: 1 (limit: 23673)
   Memory: 9.6M
   CGroup: /system.slice/backuppc.service
           └─20269 /usr/bin/perl /usr/share/BackupPC/bin/BackupPC

Jul 06 20:38:48 elk.kifarunix-demo.com systemd[1]: Started BackupPC server.

You can also verify if BackupPC is running using the BackupPC_serverMesg.

All BackupPC programs should be run as BackupPC user, which is backuppc by default as defined by the $Conf{BackupPCUser} parameter.

The backuppc user shell is set to /sbin/nologin by default, to run the BackupPC programs as backuppc user, see how the commands below are ran.

sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status info
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status hosts
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status jobs

According to BackupPC documentation, if the output of these commands doesn’t “look cryptic and confusing, and the output doesn't look like an error message, then all is ok“.

Accessing BackupPC Web User Interface

To access BackupPC from the browser, you need to first allow Apache external access on firewall, if firewall is enabled;

firewall-cmd --add-service={http,https} --permanent
firewall-cmd --reload

Ensure Apache Web server is running before you can access BackupPC web interface.

You can now access BackupPC via the URL http://server_IP_OR_hostname/backuppc.

Authenticate and proceed to BackupPC web dashboard.

backuppc web auth

BackupPC web dashboard.

backuppc dashboard

If you authenticate to BackupPC web interface as non admin user, for instance, kifarunixuser in this demo, you can see such an interface.

backuppc non admin dashboard

You have successfully installed BackupPC 4.4.0.

Reference

Read more backuppc on the documentation page.

BackupPC Documentation: Installing BackupPC

You can also access the documentation from the dashboard.

In our next guides, we will learn how to backup Linux systems with BackupPC server.

Backup Windows System via SMB Using BackupPC

Backup Windows System with BackupPC Using Rsyncd

Install and Configure BackupPC on Debian 10

How to Install and Configure BackupPC as a Backup Server on Ubuntu 18.04

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
gen_too
Co-founder of Kifarunix.com, Linux Tips and Tutorials. Linux/Unix admin and author at Kifarunix.com.

Leave a Comment