BackupPC has been working without me noticing it. Now I want set up the web interface.
First I downloaded apach2-mod_perl and perl-Tie-IxHash (there are Suse rpms) and installed them.
Directories/files that I duplicated (this is only necessary if you need to run two instances of the Apache server):
cp -a /etc/apache2 /etc/apache2backuppc
chmod -R 775 /var/log/apache2backuppc/
cp -a /var/log/apache2 /var/log/apache2backuppc
chown -R backuppc:users /var/log/apache2backuppc/ cp /var/run/httpd2.pid /var/run/httpd2backuppc.pid
chmod 644 /var/run/httpd2backuppc2.pid
chown backuppc:users /var/run/httpd2backuppc.pid cp -a /etc/sysconfig/apache2 /etc/sysconfig/apache2backuppc
chmod 644 /etc/sysconfig/apach2backuppc
chown backuppc:users /etc/sysconfig/apache2backuppc
cp /etc/init.d/apache2 /etc/apache2backuppc
Then I edited the following files:
/etc/sysconfig/apache2backuppc
Change APACHE_ACCESS_LOG to a new location!!!!
/etc/apache2backuppc/listen.conf
Change from 80 to 8080
/etc/apache2backuppc/uid.conf
Change wwwrun/www to backuppc/users
/etc/apache2backuppc/httpd.conf
1. Change all appearances of the apache2 directories into apache2backuppc
2. Change to AllowOverride Indexes AuthConfig
The following command starts up Apache2 as user backuppc and listening to the port 8080:
/usr/sbin/httpd2-prefork -f /etc/apache2backuppc/httpd.conf
For some reason it doesn't yet start up automatically at system boot.
For the web interface running in mod_perl mode I switch off the cgi script to be executed as user backuppc:
chmod u-s /srv/www/cgi-bin/BackupPC_Admin
Anyway I don't know whether apache2 supports mod_perl, because I don't get the mod_pel listed when I query:
/usr/sbin/httpd2-prefork -l
But this is maybe due to the fact that I run apache2 and not apache???
I insert the following into /etc/apach2backuppc/mod_info.conf:
LoadModule perl_module /usr/lib/apache2/mod_perl.so PerlModule Apache2
Now I have to create a .htaccess file in the cgi-bin directory with the following contect:
<Location /srv/www/cgi-bin/>
SetHandler perl-script PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order deny,allow
Deny from all
Allow from localhost
AuthName "Backup Admin"
AuthType Basic
AuthUserFile /etc/apache2/conf.d/passwd
Require valid-user
</Location>
AuthGroupFile /etc/apache2/conf.d/group AuthUserFile /etc/apache2/conf.d/passwd AuthType basic AuthName "access" require valid-user
Then I have to create the password file (use the -a flag to add a user!):
/usr/sbin/htpasswd2 -c /etc/apache2/conf.d/passwd backuppc >New password: ******* >Re-type new password: ******* >Adding password for user backuppc
Then I restarted. It didn't work. So I changed to permissions of the cgi script:
chmod 750 /srv/www/cgi-bin/BackupPC_Admin
should give as result rwxr-x---
ls -al /srv/www/cgi-bin/BackupPC_Admin
Now it works! At least I get the Administration web page loaded into my browser. But without the need to authenticate myself. And I cannot administer anything.
So I added to /etc/apache2backuppc/default-server.conf:
<Location> /srv/www/cgi-bin/BackupPC_Admin Setenv REMOTE_USER backuppc </Location>
and I changed:
<Directory "/srv/www/htdocs">
into:
AllowOverride None
</Directory>
<Directory "/srv/www/htdocs">
And I change as well:
AllowOverride Indexes AuthConfig
</Directory>
<Directory "/srv/www/cgi-bin">
into:
AllowOverride None
</Directory>
<Directory "/srv/www/cgi-bin">
I don't know what of the above is really necessary. But now authentication is working and when I type into the "Host or User name" field localhost, the script at leat tries to access the correct pages, but fails with the error:
AllowOverride Indexes AuthConfig
</Directory>
Only privileged users can view information about host localhost.
The reason appears to be that I have set up wrongly the hosts configuration file for backuppc (in my case located at /mnt/backup/conf/hosts. You have to give the correct users...
We use an external hard drive to backup. Because we don't want to have it switched on all the time we have to mount it every time we want to do a backup. The regular mount command:
sudo mount /dev/sdc1 /media/sdc1
is sufficient. However the backup directory's owner on sdc1 needs to be backuppc. We also have to restart the backuppc daemon, because if it starts up during boot (when the external drive is not connected), it cannot find the path to the backup directory:
su /etc/init.d/suse-backuppc stop /etc/init.d/suse-backuppc start /etc/init.d/suse-backuppc reload
I think the reload might not be necessary. Maybe one doesn't have to restart at all and only reloading does the job...
Then you can check whether backuppc works correctly. You have to be user backuppc to be able to so:
/usr/local/backuppc/bin/BackupPC_serverMesg status info /usr/local/backuppc/bin/BackupPC_serverMesg status jobs /usr/local/backuppc/bin/BackupPC_serverMesg status hosts