As Debian v9 does not provide anymore packages for BackupPC, I describes in this post how to migrate a BackupPC v3 (BPC3) installed from Debian packages (Debian v8) to a BackupPC v4 (BPC4) from tarball and to respect most of the Debian file hierarchy.
Define directories to store BackupPC files and configuration files
Shell
ROOT=/usr/local/share/backuppc4 | |
ETC=/etc/backuppc4 | |
LOG=/var/log/backuppc4 | |
RUN=/var/run/backuppc4 |
Copy configurations files from BPC3 before migration
Shell
cp -r /etc/backuppc $ETC | |
chown backuppc:backuppc -R $ETC |
Stop old BPC service
Shell
service backuppc stop |
Install BPC 4 files
Shell
perl ./configure.pl --batch \ | |
--install-dir $ROOT \ | |
--cgi-dir $ROOT/cgi-bin \ | |
--html-dir $ROOT/image \ | |
--data-dir /var/lib/backuppc/ \ | |
--hostname $(hostname) \ | |
--html-dir-url /backuppc4/image |
Modifiy service to access correct configuration file directory
Shell
sed -e "s,/etc/BackupPC,$ETC," \ | |
-e "s/var/log/BackupPC/,$LOG," \ | |
-e "s/var/run/BackupPC/,$RUN," $ROOT/lib/BackupPC/Lib.pm |
Create web files
Shell
mkdir $ROOT/www/ | |
{ cd $ROOT/www/; ln -s ../image .; } | |
cat > $ROOT/www/index.cgi <<EOF | |
#!/bin/sh | |
sudo -u backuppc -E -- $ROOT/cgi-bin/BackupPC_Admin | |
EOF | |
chmod a+x $ROOT/www/index.cgi |
Give access to CGI file
Shell
cat > /etc/sudoers.d/backuppc4 <<EOF | |
# User privilege specification | |
www-data ALL=(backuppc) NOPASSWD: SETENV: $ROOT/cgi-bin/BackupPC_Admin | |
EOF | |
chmog u-s $ROOT/cgi-bin/BackupPC_Admin |
Create Apache configuration file
Shell
cat > $ETC/apache.conf <<EOF | |
Alias /backuppc4 $ROOT/www | |
| |
<Directory $ROOT/www> | |
Options ExecCGI FollowSymlinks | |
AddHandler cgi-script .cgi | |
DirectoryIndex index.cgi | |
| |
AuthType Basic | |
AuthUserFile $ETC/htpasswd | |
AuthGroupFile $ETC/htgroup | |
AuthName "BackupPC Administrative Interface" | |
require valid-user | |
</Directory> | |
EOF |
Create standard directories to run BPC4
Shell
mkdir $LOG; chown backuppc:backuppc $LOG | |
mkdir $RUN; chown backuppc:backuppc $RUN |
Add Systemd service
Shell
cp systemd/backuppc.service /etc/systemd/system/backuppc4.service | |
sed -e "s,/var/run/BackupPC/,$RUN," /etc/systemd/system/backuppc4.service | |
systemctl daemon-reload | |
systemctl enable backuppc4.service | |
systemctl start backuppc4.service |