[CentOS] Setting up BackupPC on CentOS-7

Sun Sep 20 13:51:43 UTC 2015
Timothy Murphy <gayleard at eircom.net>

I'd be interested in any corrections or comments 
on the following instructions (basically for myself):

We assume that BackupPC has been installed:
  sudo yum install BackupPC

1. BackupPC must be run by the user backuppc.
Accordingly the lines
  User apache
  Group apache
in /etc/httpd/conf/httpd.conf should be changed to
  User backuppc
  Group backuppc

2. The user backuppc must be able to ssh to root (to run rsync),
since only root can access all the files on the system.
This is slightly complicated because backuppc has no default shell.
  $ su
  Passwd:
  # su -s /bin/sh backuppc
  sh-4.1$ cd
  sh-4.1$ ssh-keygen
  Generating public/private rsa key pair.
  sh-4.1$ cd .ssh
  sh-4.1$ cp id_rsa.pub /tmp
  sh-4.1$ exit
  # cd
  # ls .ssh
If .ssh exists and contains id_rsa and id_rsa.pub ignore the next command
  # ssh-keygen
  Generating public/private rsa key pair.
  # cd .ssh
  # cat /tmp/id_rsa.pub >> authorized_keys
  # su -s /bin/sh backuppc
  sh-4.1$ ssh -l root helen
helen is the name of my server - substitute the correct name or IP address
  # exit
  sh-4.1$ exit
  #

3. We must setup the graphic interface to BackupPC,
since it is more or less impossible to administer BackupPC otherwise.
I want to configure BackupPC from my laptop.
My laptop and server are on the same network 192.168.2.0
  # vi /etc/httpd/conf.d/BackupPC.conf
Firstly, after the line
  allow from 127.0.0.1
add
  allow from 192.168.2.0/255.255.255.0
(giving the IP address of your network in place of 192.168.2.0).
Secondly, change the line
      Require local
to
      Require ip 192.168.2.0/255.255.255.0 127.0.0.1

4. Give backuppc and yourself passwords to access BackupPC
  # htpasswd -c /etc/BackupPC/apache.users backuppc
  Password:
  # htpasswd -c /etc/BackupPC/apache.users yourusername
  Password:
  # exit

5. Ensure that all BackupPC files are owned by backuppc.apache
  # chown -R backuppc.apache /etc/BackupPC /etc/httpd/conf.d/BackupPC.conf 
/var/lib/BackupPC

6. Restart BackupPC and apache
  # systemctl restart backuppc
  # systemctl restart httpd

7. Now see if you can access BackupPC on your server:
  Browse to http://localhost/backuppc
If this succeeds give username backuppc and the password you chose for 
yourself above

8. Now try the same on your laptop:
  Browse to http://helen/backuppc
(substituting your server's name or IP address for "helen").
Again give username backuppc and the password you chose for yourself above.

9. Returning to the server,
  # cd /etc/BackupPC
  # vi hosts
I appended the line
  helen 0 backuppc
to this file - you can choose any name here in place of helen
it does not have to be the name of your server.

10. Now browse again to BackupPC, on laptop or server.
Where it says "Select a host" give the name you just chose.
Click on "Edit Config" and then on "Xfer"
and in the RsyncShareName line add the directory or directories 
on your server that you want to backup, and then click on Save.
(I chose /Photos, /common/tim and /var/www, 
but of course this is entirely up to you.)
Click on "helen Home" (substituting the name you chose above),
and press "Start full backup".



-- 
Timothy Murphy  
gayleard /at/ eircom.net
School of Mathematics, Trinity College, Dublin