Installing BackupPC on CentOS
The definitive guide to installing...
or close enough
Part 1 of 3
I, recently, was able to install BackupPC on a new installation of CentOS 7 so I was able to go through my notes and put them in a coherent form. Below is what I consider 'coherent.' :) I decided to break this into 3 parts because, as I was writing, it became long. The three parts are: 1. BackupPC Installation 2. Configuration of Server 3. Adding Linux and Apple Hosts
If something doesn't make sense, please post a comment.
- I disable selinux. If this isn't something you want to do and you know how to configure BackupPC with selinux enabled, please post a note and I'll make an addition to this list.
- To disable selinux, edit the file: /etc/sysconfig/selinux
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
- Change the line that reads: SELINUX=enforcing to SELINUX=disabled
- Restart the computer
- To disable selinux, edit the file: /etc/sysconfig/selinux
- Install epel-release, backuppc, and sendmail, if not already installed
yum install epel-release yum install backuppc sendmail
- Add a BackupPC Admin user
- From root, type: htpasswd /etc/BackupPC/apache.users <<admin username>>
- Example: # htpasswd /etc/BackupPC/apache.users bpcadmin
- When prompted, enter a password of your choice, twice
# htpasswd /etc/BackupPC/apache.users bpcadmin New password: Re-type new password: Adding password for user bpcadmin
- If you already know which users that will need access to BackupPC, you can add users this same way now or come back at a later time
- From root, type: htpasswd /etc/BackupPC/apache.users <<admin username>>
- With the Backup Drive mounted, create the folders, and change the permissions to allow the backuppc user access
# mkdir /media/backups/BackupPC # mkdir /media/backups/BackupPC/pc # mkdir /media/backups/BackupPC/cpool # chown -R backuppc /media/backups/BackupPC/
- Edit the BackupPC config file: /etc/BackupPC/config.pl
- Around line 300, look for: $Conf{TopDir} and add the path where the backups will be stored.
$Conf{TopDir} = '/media/backups/BackupPC/'; $Conf{ConfDir} = '/etc/BackupPC/'; $Conf{LogDir} = '/var/log/BackupPC'; $Conf{InstallDir} = '/usr/share/BackupPC'; $Conf{CgiDir} = '/usr/share/BackupPC/sbin/';
- In the same file, scroll down further, around line 2030, and look for: $Conf{CgiAdminUsers}
- Add the Admin user created above. This gives the Admin access to make changes via the Web Gui
$Conf{CgiAdminUserGroup} = ''; $Conf{CgiAdminUsers} = 'bpcadmin';
- Save the file
- Around line 300, look for: $Conf{TopDir} and add the path where the backups will be stored.
- Give the backuppc user permission to run anywhere on server
- Run command as root: visudo
- Look for "Allow root to run any commands anywhere"
- Below the line: root ALL=(ALL) ALL
- Add: backuppc ALL=NOPASSWD: ALL
## Allow root to run any commands anywhere root ALL=(ALL) ALL backuppc ALL=NOPASSWD: ALL
- Save file
- Start the BackupPC service
# systemctl start backuppc.service
- Helpful tip: If the service fails, run the following as root to view the errors
# sudo -u backuppc /usr/share/BackupPC/bin/BackupPC -d
- Helpful tip: If the service fails, run the following as root to view the errors
- If Successful, log in to website with Admin user
- http://localhost/BackupPC
- Helpful tip: The word, BackupPC, is case sensitive
- http://localhost/BackupPC
- Click 'Edit Config' and check the PingPath setting
- If blank, change it to: /usr/bin/ping
- If blank, change it to: /usr/bin/ping
- Click 'Email' and check the SendmailPath setting
- If blank, change it to /usr/sbin/sendmail
Jump over to Part 2 and continue...