Installing BackupPC 4 from tarball on CentOS 7
This is a basic guide on how to install BackupPC version 4.3.1 from tarball (or git) on CentOS 7.6. We use the epel-release repository for several packages. We also temporarily use the epel-testing repository to install BackupPC-XS and rsync-bpc.
1. Enable the epel-release repo.
yum --enablerepo=extras -y install epel-release
2. Install BackupPC-XS and rsync-bpc
yum --enablerepo=epel-testing -y install BackupPC-XS rsync-bpc
3. Install the following requisites for BackupPC version 4.3.1
yum -y install bzip2 httpd mod_perl par2cmdline perl-Archive-Zip perl-CGI \ perl-Compress-Raw-Zlib perl-Data-Dumper perl-Digest-MD5 perl-File-Listing \ perl-File-RsyncP perl-Net-FTP-AutoReconnect perl-Net-FTP-RetrHandle \ perl-Time-ParseDate perl-XML-RSS perl-version rrdtool samba-client
4. Lets set up some directories that we are going to use later.
My backuppc server has a raid6 array mounted at /data0/. I am going to use this to store the data for backuppc. Lets create the backuppc folder on my raid. Note: this folder can grow to be extremely large.
mkdir -p /data0/backuppc
Now lets create one more folder for BackupPC to store some web interface files.
mkdir -p /var/www/html/backuppc
And create the cgi-bin directory for backuppc
mkdir -p /var/www/cgi-bin/backuppc
Make note of those 2 directories. The installer will ask for them if we don't explicitly set them below.
5. Create and setup the backuppc user.
Create group backuppc.
groupadd backuppc
Create backuppc user, and tell it where its home folder is. My backuppc user's home folder is /opt/backuppc. Change this to whatever you'd like.
useradd --home-dir /opt/backuppc --create-home --shell /bin/bash --base-dir /opt/backuppc --gid backuppc backuppc
6. Set Permissions on the directories we created:
chown -R backuppc:backuppc /data0/backuppc chown -R backuppc:backuppc /opt/backuppc
7. Download the BackupPC tar.gz archive and extract it.
cd ~ wget https://github.com/backuppc/backuppc/releases/download/4.3.1/BackupPC-4.3.1.tar.gz tar zxf BackupPC-4.3.1.tar.gz cd BackupPC-4.3.1
8. Run the configure.pl script
Pay close attention to the paths in this command.
perl configure.pl --batch --cgi-dir /var/www/cgi-bin/backuppc \ --data-dir /data0/backuppc --hostname backuppc --html-dir /var/www/html/backuppc \ --html-dir-url /backuppc --install-dir /opt/backuppc
Alternatively, you can execute the perl script with no arguments and it will walk you through the install step by step. This is the preferred method if you are upgrading a version 3.X install. (Not supported by this guide)
perl configure.pl
9. Apache config
I chose the CGI route (not S-CGI) and chose the directory /var/www/cgi-bin/backuppc for my CGI directory. I chose /var/www/html/backuppc as my images directory. You may need to set this path in the config if you ran the configure.pl script with no arguments.
Now we need to copy the Apache config into the apache conf.d directory.
cp httpd/BackupPC.conf /etc/httpd/conf.d/
Note: This file contains "deny from all" and "allow from 127.0.0.1". This makes it so you can only load the BackupPC web interface from the server its self. You can modify this to your liking. I deleted the line "allow from 127.0.0.1" and changed "deny from all" to "allow from all".
We need to modify the user that apache runs as.
vim /etc/httpd/conf/httpd.conf
Edit httpd.conf and change: User apache to User backuppc
Note: This has the potential to break things if you use Apache for any purpose other than BackupPC. I wasn't able to figure out how to get this working without modifying this. If you have any information that would help, please update this wiki!
10. Install the included systemd script:
cp systemd/backuppc.service /etc/systemd/system/ systemctl daemon-reload systemctl start backuppc systemctl enable backuppc
11. Create the backuppc authentication file.
htpasswd -c /etc/BackupPC/BackupPC.users backuppc
Note: this sets the username to backuppc (modify it to your liking)
Set permissions on this file.
chown backuppc:backuppc /etc/BackupPC/BackupPC.users
12. Edit the config.pl file in /etc/BackupPC/
vim /etc/BackupPC/config.pl
Check the image directory and image url variables.
$Conf{CgiImageDir} = '/var/www/html/backuppc';
$Conf{CgiImageDirURL} = '/backuppc';Also add backuppc as the administrative user: $Conf{CgiAdminUsers} = 'backuppc';
13. Now lets start apache
systemctl start httpd systemctl enable httpd
14. Access the BackupPC Admin interface:
http://yourserverip/BackupPC_Admin
Log in with the username and password we created in step 11.