BackupPC
1. What is BackupPC
BackupPC is a high-performance, enterprise-grade system for backing up Linux, WinXX and MacOSX PCs and laptops to a server’s disk. BackupPC is highly configurable and easy to install and maintain.
Product homepage: http://backuppc.sourceforge.net/
Documentation: https://backuppc.github.io/backuppc/BackupPC.html
2. Install BackupPC
This manual covers the installation of BackupPC from an install from archive (zip/tar file).
| This installation guide is specific to Oracle Linux. |
Refer to the new product document located at https://backuppc.github.io/backuppc/BackupPC.html
2.1. Unzip
Unzip the archive to the target install location, for example, /opt/backuppc
Ensure Perl is installed;
which perl
If not, install it, and any of its dependent packages.
sudo yum install perl
Ensure CPAN is installed, as it will make installing the other Perl modules so much easier;
sudo yum install perl-CPAN
YAML is required for CPAN;
sudo yum install perl-YAML
2.2. Configure CPAN
First change to root, otherwise files cannot be installed;
sudo su –
Ensure the proxy is setup by issuing;
export http\_proxy=http://user: [email protected]:8080/
cpan
Use the auto configuration, but select NO when asked about connecting to the internet. Manually select mirrors from South Africa. Select all of them. Allow it to make changes to the shell config.
From the CPAN command, run;
install Bundle::LWP
install App::cpanminus
Check if Perl modules Compress::Zlib, Archive::Zip and File::RsyncP have been installed;
perl -e 'use Compress::Zlib; print $Compress::Zlib::VERSION."\n"'
perl -e 'use Archive::Zip; print $Archive::Zip::VERSION."\n"'
perl -e 'use File::RsyncP; print $File::RsyncP::VERSION."\n"'
sudo rpm -i perl-Archive-Zip-1.30-11.el7.noarch.rpm
sudo rpm -i perl-File-RsyncP-0.74-2.el7.x86\_64.rpm
Install BackupPC Perl module
sudo rpm -i BackupPC-XS-0.53-1.el7.x86_64.rpm
Perl modules can be installed using the instruction from; [http://www.cpan.org/modules/INSTALL.html](http://www.cpan.org/modules/INSTALL.html)
Start by installing cpanm
cpan App::cpanminus
3. Clients install - Using tar
This section will describe the steps to configure the client PC (the PC to be backed up) for BackupPC.
It is better to create a low-privileged backuppc user on the client and use sudo on the client to run the backup command (eg: tar or rsync) as root. This greatly improves security of the solution.
sudo useradd backuppc -g backup
sudo mkdir -p /home/backuppc/.ssh
sudo cp /var/share/config/backuppc/authorized_keys /home/backuppc/.ssh/
sudo chown -R backuppc:backup /home/backuppc/.ssh
sudo chmod 700 /home/backuppc/.ssh
sudo chmod 600 /home/backuppc/.ssh/authorized_keys
Create a scripts that can be run by BackupPC over the SSH connection;
sudo nano /usr/bin/backup_tar
with the following content;
#!/bin/sh -f (1)
#####################################################
#
# Script run by BackupPC with no password sudo rights
#
#####################################################
exec /bin/tar "$@" (2)
| 1 | The -f here is used to turn off Glob-Pattern expansion. |
| 2 | The "$@" construct specifies that all parameters passed in to this script should be passed on to tar. |
This scrips is therefor used as an "alias" tar command to which the BackupPC use will have root access, using sudo, and will be configured to allow sudo execution without a password.
Ensure the script file is executable and owned by the BackupPC user.
sudo chmod 554 /usr/bin/backup_tar
sudo chown backuppc /usr/bin/backup_tar
The script file is located on the share drive and can be installed as such;
sudo cp /var/share/config/backuppc/backup_tar /usr/bin/
sudo chmod 554 /usr/bin/backup_tar
sudo chown backuppc:users
Or simply run the utility script that performs the above commands;
sudo /var/share/config/backuppc/setup.sh
Edit the sudoers file to allow the BackupPC user to execute the backup script commands without password;
sudo visudo
Check if the following line exists:
Defaults requiretty
If so, invert the setting as follows;
Defaults !requiretty
| If the above setting is not present it can be ignored completely. |
Add the following under the command alias section
# WSO2 team
Cmnd_Alias BACKUP=/usr/bin/backup_tar
And append this to the end of the file;
backuppc ALL = NOPASSWD: BACKUP
| Take note of the spaces in the config lines! Best to copy and paste the text above. |
Run the following command while logged in as the BackupPC user on the Master server to ensure it can connect.
sudo su backuppc
ssh -l backuppc pepwso2manp1 sudo /usr/bin/backup_tar
On the first attempt SSH will prompts to accept the fingerprint. Answer YES.