This is a complete guide to install BackupPC on your CentOS 7 server.

#Install BackupPC and prerequsities

yum upgrade -y
yum install epel-release
yum install backuppc nfs-utils nfs-utils-lib bzip2
systemctl restart backuppc.service

#Set permissions

cd /usr/share/BackupPC/
chown backuppc:apache sbin/*

cd /usr/share/BackupPC/sbin
chmod u+s BackupPC_Admin

usermod -s /bin/bash backuppc

#Set firewall rule for HTTP port.

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

#Edit BackupPC config

vi /etc/BackupPC/config.pl

Edit

$Conf{CgiAdminUserGroup} = '';
 $Conf{CgiAdminUsers} = '';

TO

$Conf{CgiAdminUserGroup} = '';
 $Conf{CgiAdminUsers} = 'backuppc';

THEN

Edit

$Conf{PingPath} = '';

TO

$Conf{PingPath} = '/bin/ping';

#Edit your apache configuration

vi /etc/httpd/conf.d/BackupPC.conf
<Directory /usr/share/BackupPC/>
 # BackupPC requires valid authentication in order for the web interface to
 # function properly. One can view the web interface without authentication
 # though all functionality is disabled.
 #
 # htpasswd -c /etc/BackupPC/apache.users yourusername
 #
AuthType Basic
 AuthUserFile /etc/BackupPC/apache.users
 AuthName "BackupPC"
<IfModule mod_authz_core.c>
 # Apache 2.4
 <RequireAll>
 Require valid-user
 <RequireAny>
 Require local
 # --> In order to access only this specific IP
 Require ip 192.168.16
 # --> Uncomment for access everywhere
 # Require all granted
 </RequireAny>
 </RequireAll>
 </IfModule>
 <IfModule !mod_authz_core.c>
 AllowOverride All
 Order allow,deny
 Deny from all
 </IfModule>
</Directory>
Alias /BackupPC/images /usr/share/BackupPC/html/
 ScriptAlias /BackupPC /usr/share/BackupPC/sbin/BackupPC_Admin
 ScriptAlias /backuppc /usr/share/BackupPC/sbin/BackupPC_Admin

#Create username and password for BackupPC GUI

htpasswd -c /etc/BackupPC/apache.users backuppc

New password:
Re-type new password:
Adding password for user backuppc

#Restart your services

systemctl restart backuppc.service
systemctl restart httpd.service

#Then add your ssh key to your remote server.

su - backuppc
ssh-keygen -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/BackupPC/.ssh/id_rsa):
Created directory ‘/var/lib/BackupPC/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/BackupPC/.ssh/id_rsa.
Your public key has been saved in /var/lib/BackupPC/.ssh/id_rsa.pub.

ssh-copy-id root@your-remote-ip

#Test it.

ssh root@your-remote-ip

#Then go

http://your-ip/BackupPC

#Enter your username and password that you created before #htpasswd -c /etc/BackupPC/apache.users backuppc

#Go “Edit Hosts”

#Click Add

#Then write an hostname or IP of your remote server

#Then click SAVE

#Refresh your page and select your host.

!!! DO NOT FORGET INSTALL RSYNC TO YOUR REMOTE SERVER !!!

#Click “Edit Config” for your selected host

#Select Xfer

#Add “*” value for “BackupFilesOnly” Box

#Write down your path name that you want to create backup in RsyncShareName Box

#Then Click Save.!

#Click Start FULL BACKUP

You are ready to go!

Windows SMB Backup

You can also take backup of your Windows clients using BackupPC

The basic steps are

  • Create a backuppc user in your domain/client with backup operator privileges
  • Create a share on client server and give read and list folder permissions to backuppc user
  • Create inbound firewall rule for BackupPC server
  • Test your configuration by typing from BackupPC Server
    • smbclient -U “Domain\backuppc” //CLIENTIP/ShareName
    • You will see smb prompt, try to list the files by typing “dir”
  • Add the client to backuppc and edit the credentials:
    • change Xfer method to SMB
    • enter username as DOMAIN\user
    • enter password
    • change share name from C$ to Share Name given

 

5 Responses to Centos 7 – BackupPC Installation Guide
  1. This is a very good article. Using a COPR as backuppc source, I got BackupPC v4.3.0 to work using your guide with only one addition. I had to modify the /etc/httpd/conf/httpd.conf by changing the “User apache” to “User backuppc” and I had v4.3.0 running on CentOS 7.6.1810. THANKS!!

  2. Two commands are missing :

    # systemctl enable backuppc.service
    # systemctl enable httpd.service

  3. There is no way I can install backuppc in Centos because the EPEL repo has no backuppc package. So we are left with compiling from source.

    • Hi Allan,
      I can see that epel includes backuppc packages:
      [root@www]# yum list backuppc
      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
      * base: mirror.rackdc.com
      * epel: mirror.veriteknik.net.tr
      * extras: mirror.rackdc.com
      * remi-php74: mirror.veriteknik.net.tr
      * remi-safe: mirror.veriteknik.net.tr
      * updates: mirror.rackdc.com
      Available Packages
      BackupPC.x86_64 3.3.1-5.el7 epel


[top]

Leave a Reply

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