{"id":9514,"date":"2021-07-06T21:29:40","date_gmt":"2021-07-06T18:29:40","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9514"},"modified":"2024-03-18T19:51:03","modified_gmt":"2024-03-18T16:51:03","slug":"install-and-configure-backuppc-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-configure-backuppc-on-rocky-linux-8\/","title":{"rendered":"Install and Configure BackupPC on Rocky Linux 8"},"content":{"rendered":"\n
In this guide, we are going learn how to install and configure BackupPC on Rocky Linux 8. BackupPC<\/a> 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\u2019s disk.<\/p>\n\n\n\n Some of the features of BackupPC include;<\/p>\n\n\n\n Read more about BackupPC features on About BackupPC<\/a> page.<\/p>\n\n\n\n Update your system packages.<\/p>\n\n\n\n BackupPC 4 is available on EPEL repos. Therefore, install the EPEL repos on Rocky Linux 8 by running the command;<\/p>\n\n\n\n EPEL repos provided BackupPC 4.3.2, which is the current stable release as of this writing.<\/p>\n\n\n\n Also, enable PowerTool Repos;<\/p>\n\n\n\n You can simply install BackupPC and all its required dependencies by executing the command below;<\/p>\n\n\n\n BackupPC supports different protocols to get backup data from devices being backed up:<\/p>\n\n\n\n It also supports the use of To define your preferred BackupPC backup protocol, open the BackupPC configuration file, For instance, the Rsync{d} protocol configuration section begins at;<\/p>\n\n\n\n and ends at where FTP configuration starts;<\/p>\n\n\n\n To use You can find the absolute path for rsync using Hence, the client path should be set like;<\/p>\n\n\n\n Also ensure that the backup transfer method, By default, BackupPC uses the root user on the backup clients for backup purposes.<\/p>\n\n\n\n It is more secure to allow backup via a low-privileged user.<\/p>\n\n\n\n In this demo, we will create a non-privileged user, 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n In this demo, we set the By default, BackupPC writes backup data into \/var\/lib\/BackupPC directory.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n For example, assuming you have an empty drive, \/dev\/sdb1 as in our case, then you can simply mount it under, To automount on boot, update the \/etc\/fstab with the entry with the line below;<\/p>\n\n\n\n Update the file-system accordingly.<\/p>\n\n\n\n Save and exit the file.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n Therefore, you can open BackupPC Apache configuration, To allow external access to BackupPC, change the line, Save and quit the configuration file.<\/p>\n\n\n\n Create the BackupPC authentication user and password and store them in the file specified by the value of the For example, to create web authentication user called You can add another user, say Adjust the permissions of the auth user file;<\/p>\n\n\n\n Change the user under which Apache runs as from Disable Apache Welcome Page;<\/p>\n\n\n\n Disable directory listing;<\/p>\n\n\n\n Check Apache for any errors;<\/p>\n\n\n\n Start and enable Apache to run on system boot;<\/p>\n\n\n\n Once done with the configurations, start and enable BackupPC to run on system boot;<\/p>\n\n\n\n To check the status;<\/p>\n\n\n\n You can also verify if BackupPC is running using the All BackupPC programs should be run as BackupPC user, which is The backuppc user shell is set to According to BackupPC documentation, if the output of these commands doesn\u2019t \u201c To access BackupPC from the browser, you need to first allow Apache external access on firewall, if firewall is enabled;<\/p>\n\n\n\n Ensure Apache Web server is running before you can access BackupPC web interface.<\/strong><\/p>\n\n\n\n You can now access BackupPC via the URL Authenticate and proceed to BackupPC web dashboard.<\/p>\n\n\n\n BackupPC web dashboard.<\/p>\n\n\n\n If you authenticate to BackupPC web interface as non admin user, for instance, You have successfully installed BackupPC 4.4.0.<\/p>\n\n\n\n Read more backuppc on the documentation page.<\/p>\n\n\n\n BackupPC Documentation: Installing BackupPC<\/a><\/p>\n\n\n\n You can also access the documentation from the dashboard.<\/p>\n\n\n\n In our next guides, we will learn how to backup Linux systems with BackupPC server.<\/p>\n\n\n\n Backup Windows System via SMB Using BackupPC<\/a><\/p>\n\n\n\n Backup Windows System with BackupPC Using Rsyncd<\/a><\/p>\n\n\n\n Install and Configure BackupPC on Debian 10<\/a><\/p>\n\n\n\n\n
Installing BackupPC on Rocky Linux 8<\/h2>\n\n\n\n
Run System Update<\/h3>\n\n\n\n
dnf update<\/code><\/pre>\n\n\n\n
Install BackupPC on Rocky Linux 8<\/h3>\n\n\n\n
dnf install epel-release<\/code><\/pre>\n\n\n\n
dnf info backuppc<\/code><\/pre>\n\n\n\n
\nAvailable Packages\nName : BackupPC\nVersion : 4.4.0\nRelease : 1.el8\nArchitecture : x86_64\nSize : 489 k\nSource : BackupPC-4.4.0-1.el8.src.rpm\nRepository : epel\nSummary : High-performance backup system\nURL : http:\/\/backuppc.github.io\/backuppc\/index.html\nLicense : GPLv2+\nDescription : BackupPC is a high-performance, enterprise-grade system for backing up Linux\n : and WinXX and Mac OS X PCs and laptops to a server's disk. BackupPC is highly\n : configurable and easy to install and maintain.\n : \n : NOTE: Proper configuration is required after install, see README.setup for more\n : information.\n<\/code><\/pre>\n\n\n\n
dnf config-manager --set-enabled powertools<\/code><\/pre>\n\n\n\n
dnf install -y backuppc<\/code><\/pre>\n\n\n\n
Configure BackupPC Server on Rocky Linux 8<\/h2>\n\n\n\n
Define BackupPC Backup Protocol<\/h3>\n\n\n\n
\n
ftp<\/code> protocol. The use FTP is however not a recommended method of backup.<\/p>\n\n\n\n
\/etc\/BackupPC\/config.pl<\/strong><\/code> and navigate to the section of the specific backup protocol you want to use.<\/p>\n\n\n\n
vim \/etc\/BackupPC\/config.pl<\/code><\/pre>\n\n\n\n
...\n###########################################################################\n# Rsync\/Rsyncd Configuration\n# (can be overwritten in the per-PC log file)\n###########################################################################\n...<\/code><\/pre>\n\n\n\n
...\n...\n###########################################################################\n# FTP Configuration\n# (can be overwritten in the per-PC log file)\n##########################################################################\n...<\/code><\/pre>\n\n\n\n
rsync<\/strong><\/code> protocol for backup, ensure that rsync<\/strong> is installed on a client being backed up<\/strong> and that the correct path is defined for the parameter,
$Conf{RsyncClientPath<\/strong><\/code>.<\/p>\n\n\n\n
which<\/code> command.<\/p>\n\n\n\n
which rsync<\/code><\/pre>\n\n\n\n
\/usr\/bin\/rsync<\/strong><\/code><\/pre>\n\n\n\n
$Conf{RsyncClientPath} = \"\/usr\/bin\/rsync<\/strong>\";<\/code><\/pre>\n\n\n\n
$Conf{XferMethod<\/code>, for the client is set to
rsync<\/code>.<\/p>\n\n\n\n
$Conf{XferMethod} = \"rsync\";<\/code><\/pre>\n\n\n\n
Define BackupPC Client Backup User<\/h3>\n\n\n\n
$Conf{RsyncSshArgs} = ['-e', '$sshPath -l root<\/strong>'];<\/code><\/pre>\n\n\n\n
backuppc<\/strong><\/code>, on every client to backup
which is only allowed to run rsync command with sudo rights<\/strong><\/code> for backup purposes. Therefore, change this user accordingly.<\/p>\n\n\n\n
$Conf{RsyncSshArgs} = ['-e', '$sshPath -l backuppc'];<\/code><\/pre>\n\n\n\n
Configure BackupPC Administrative User<\/h3>\n\n\n\n
kifarunixadmin<\/strong><\/code> user as BackupPC admin.<\/p>\n\n\n\n
$Conf{CgiAdminUsers} = 'kifarunixadmin';<\/code><\/pre>\n\n\n\n
Change Backup Data Directory<\/h3>\n\n\n\n
$Conf{TopDir} = '\/var\/lib\/BackupPC\/';<\/code><\/pre>\n\n\n\n
\/var\/lib\/BackupPC\/<\/code>.<\/p>\n\n\n\n
mount \/dev\/sdb1 \/var\/lib\/BackupPC\/<\/code><\/pre>\n\n\n\n
\/dev\/sdb1 \/var\/lib\/BackupPC xfs defaults 1 2<\/code><\/pre>\n\n\n\n
Configure BackupPC Apache Authentication<\/h3>\n\n\n\n
\/etc\/httpd\/conf.d\/BackupPC.conf<\/strong><\/code>, which is created by default and make your preferred changes. For example, these are a few changes we made,
AuthUserFile<\/strong><\/code> and
AuthName<\/strong><\/code>.<\/p>\n\n\n\n
vim \/etc\/httpd\/conf.d\/BackupPC.conf<\/code><\/pre>\n\n\n\n
...\nAuthType Basic\nAuthUserFile \/etc\/BackupPC\/.backuppc\nAuthName \"Kifarunix BackupPC Restricted Access\"\n\n<IfModule mod_authz_core.c>\n...<\/code><\/pre>\n\n\n\n
Require local<\/strong><\/code> to
Require all granted<\/strong><\/code>.<\/p>\n\n\n\n
...\n<IfModule mod_authz_core.c>\n # Apache 2.4\n <RequireAll>\n Require valid-user\n <RequireAny>\n #Require local\n Require all granted\n<\/strong> <\/RequireAny>\n <\/RequireAll>\n<\/IfModule>\n...<\/code><\/pre>\n\n\n\n
AuthUserFile<\/strong><\/code> parameter above.<\/p>\n\n\n\n
kifarunixadmin<\/code>;<\/p>\n\n\n\n
htpasswd -c \/etc\/BackupPC\/.backuppc kifarunixadmin<\/code><\/pre>\n\n\n\n
kifarunixuser<\/code>.<\/p>\n\n\n\n
htpasswd \/etc\/BackupPC\/.backuppc kifarunixuser<\/code><\/pre>\n\n\n\n
chmod 666 \/etc\/BackupPC\/.backuppc<\/code><\/pre>\n\n\n\n
apache<\/code> to
backuppc<\/code> and leave the group as
apache<\/code>;<\/p>\n\n\n\n
vim \/etc\/httpd\/conf\/httpd.conf<\/code><\/pre>\n\n\n\n
...\nUser backuppc<\/strong>\nGroup apache\n...<\/code><\/pre>\n\n\n\n
mv \/etc\/httpd\/conf.d\/welcome.conf \/etc\/httpd\/conf.d\/welcome.conf.old<\/code><\/pre>\n\n\n\n
sed -i 's\/Options Indexes FollowSymLinks\/Options -Indexes +FollowSymLinks\/' \/etc\/httpd\/conf\/httpd.conf<\/code><\/pre>\n\n\n\n
httpd -t<\/code><\/pre>\n\n\n\n
Syntax OK<\/code><\/pre>\n\n\n\n
systemctl enable --now httpd<\/code><\/pre>\n\n\n\n
Running BackupPC<\/h3>\n\n\n\n
systemctl enable --now backuppc<\/code><\/pre>\n\n\n\n
systemctl status backuppc<\/code><\/pre>\n\n\n\n
\u25cf backuppc.service - BackupPC server\n Loaded: loaded (\/usr\/lib\/systemd\/system\/backuppc.service; disabled; vendor preset: disabled)\n Active: active (running) since Tue 2021-07-06 20:38:48 EAT; 4s ago\n Main PID: 20269 (BackupPC)\n Tasks: 1 (limit: 23673)\n Memory: 9.6M\n CGroup: \/system.slice\/backuppc.service\n \u2514\u250020269 \/usr\/bin\/perl \/usr\/share\/BackupPC\/bin\/BackupPC\n\nJul 06 20:38:48 elk.kifarunix-demo.com systemd[1]: Started BackupPC server.<\/code><\/pre>\n\n\n\n
BackupPC_serverMesg<\/strong><\/code>.<\/p>\n\n\n\n
backuppc<\/code> by default as defined by the
$Conf{BackupPCUser}<\/strong><\/code> parameter.<\/p>\n\n\n\n
\/sbin\/nologin<\/code> by default, to run the BackupPC programs as backuppc user, see how the commands below are ran.<\/p>\n\n\n\n
sudo -u backuppc \/usr\/share\/BackupPC\/bin\/BackupPC_serverMesg status info<\/code><\/pre>\n\n\n\n
sudo -u backuppc \/usr\/share\/BackupPC\/bin\/BackupPC_serverMesg status hosts<\/code><\/pre>\n\n\n\n
sudo -u backuppc \/usr\/share\/BackupPC\/bin\/BackupPC_serverMesg status jobs<\/code><\/pre>\n\n\n\n
look cryptic and confusing, and the output doesn't look like an error message, then all is ok<\/code><\/strong><\/em>\u201c.<\/p>\n\n\n\n
Accessing BackupPC Web User Interface<\/h2>\n\n\n\n
firewall-cmd --add-service={http,https} --permanent<\/code><\/pre>\n\n\n\n
firewall-cmd --reload<\/code><\/pre>\n\n\n\n
http:\/\/server_IP_OR_hostname\/backuppc<\/code><\/strong>.<\/p>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
kifarunixuser<\/code> in this demo, you can see such an interface.<\/p>\n\n\n\n
<\/figure>\n\n\n\n
Reference<\/h3>\n\n\n\n