wiki.ipfire.org

The community-maintained documentation platform of IPFire

User Tools

Site Tools


addons:backuppc:start

BackupPC

By the usage of IPFire as a home server with the Samba-AddOn the question of a backup of all user data comes up. Also the computers in the network should be backed up regularly. Therefor BackupPC advertise itself, because it manages all the files in a pool and same files from different computers will be realized and thus not double saved. BackupPC provides also many additional features, these can be found in the documentation of BackupPC.

The following describes how BackupPC can be configured on the IPFire.

Requirements to install BackupPC

  • rsync (if you want to work with the rsync protocol)
  • samba (if you want to work with the smb protocol)

They can be installed, like any other Addon over Pakfire.

Install the missing Perl-modules

BackupPC requires additional Perl modules, which are not part of IPFire. Since CPAN is also not part of IPFire, the missing CPAN modules can simply loaded down.

The following modules are required:

  • Compress::Zlib
  • Archive::Zip
  • File::RsyncP (see below)

The “File::rsyncp” is only necessary for the rsync protocol, SMB works also without this module. The installation of this module is somewhat more complicated, because it is not only pure Perl code, but also binaries, which naturally must be compiled first. These can be downloaded for IPFire 2.5 core 33 from here.

Who would like to compile them on his own, needs to setup a Development System, download the source code and build the system. How this works can be checked in here. Change to the build-system with:

./make.sh shell

You can load and install the module with:

perl -MCPAN -e "install File::RsyncP"

Copy the generated binaries from

 File-RsyncP-0.68/blib/arch/auto

to

 /usr/lib/perl5/perl5.8.8/auto 

and set the permissions with:

 chown -R root.root /usr/lib/perl5/perl5.8.8/auto/File
 chmod -R 755 /usr/lib/perl5/perl5.8.8/auto/File

Copy also the *.pm files and directories from

 File-RsyncP-0.68/blib/lib/File 

to

 /usr/lib/perl5/perl5.8.8/File 

and set here also the owner and the correct permissions with:

 chown -R root.root /usr/lib/perl5/perl5.8.8/File
 chmod -R 555 /usr/lib/perl5/perl5.8.8/File

Attention: In the Core-Update-48 a new Perl-version (5.12.3) is used!

The following files needs to be copied in the following paths ( the data from File::RsyncP-Version 0.70 can be downloaded under the following link http://forum.ipfire.org/index.php?action=dlattach;topic=4470.0;attach=1609 ) - after you unzip the file copy it to IPFire and extract it with tar -xzf File-RsyncP-0.70.tar

You need to copy the folder /blib/lib/File/ and the whole content in the path /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/ (there are the *.pm files) and change the file permission with a:

chmod -R 555 /blib/lib/File

You need also to copy the folder /blib/arch/auto/File (including all subdirectories with the *.bs and *.so files in it) plus the folder /blib/lib/auto/File/ (the autosplit.ix-Files) to /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/ and change the file permissions to:

chmod -R 755 /blib/lib/File

It should then looks like this:

  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/File/RsyncP.pm
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/File/RsyncP/Digest.pm
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/File/RsyncP/FileIO.pm
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/File/RsyncP/FileList.pm
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/Digest/Digest.bs
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/Digest/Digest.so
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/Digest/autosplit.ix
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/FileList/FileList.bs
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/FileList/FileList.so
  * /usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/File/RsyncP/FileList/autosplit.ix

Proceeded than similarly, with “Compress::Zlib” and “Archive::Zip”. However, there are only *. pm files, which are placed under lib, not under blib.

Download BackupPC

Download the latest version of BackupPC from HERE and copy it via WinSCP onto the IPFire into the directory /root/ and unpack it with “tar xvf ……tar.gz”. Change then into the the directory and execute:

./configure.pl

Now, some information will be requested. The following should be answered with:

  • Full path to existing main config.pl []? ENTER
  • Are these paths correct [y]? ENTER
  • BackupPC will run on host [ipfire]? ENTER
  • BackupPC should run as user [backuppc]? nobody ENTER
  • Install directory (full path) [/usr/local/BackupPC]? /var/ipfire/BackupPC ENTER
  • Data directory (full path) [/data/BackupPC]? use a sensible directory path for example /mnt/harddisk/backuppc ENTER
  • Compression level [3]? if desired ENTER, if not 0 ENTER (needs CPU performance for the backup)
  • CGI bin directory (full path) []? /srv/web/backuppc/cgi-bin ENTER
  • Apache image directory (full path) []? /srv/web/backuppc/images ENTER
  • URL for image directory … []? /images
  • Do you want to continue? [y]? check everything again and press then ENTER

Establish the BackupPC service

BackupPC requires a running service. Therefor, apply in /etc/init.d a file named “BackupPC” with the following content:

touch /etc/init.d/BackupPC
File: /etc/init.d/BackupPC
#!/bin/sh
#
# DESCRIPTION
#
# Startup init script for BackupPC on ipfire.
#
# Distributed with BackupPC version 3.2.0beta0, released 5 April 2009.
#
 
 
BINDIR=/var/ipfire/BackupPC/bin
DATADIR=/mnt/harddisk/backuppc
LOGDIR=/var/log/BackupPC
 
NAME=BackupPC
DAEMON=BackupPC
 
test -x $BINDIR/$DAEMON || exit 0
 
. /etc/sysconfig/rc
. $rc_functions
 
 
case "$1" in
  start)
    boot_mesg "Starting $NAME: "
    loadproc sudo -u nobody $BINDIR/$DAEMON -d
    ;;
 
  stop)
    boot_mesg "Stopping $NAME: "
    killproc -p $LOGDIR/BackupPC.pid $BINDIR/$DAEMON 
    ;;
 
  reload)
    boot_mesg "Reloading $NAME: "
    reloadproc $BINDIR/$DAEMON
    ;;
 
  status)
    statusproc $BINDIR/$DAEMON
    ;;
 
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|reload|status}"
    exit 1
    ;;
esac
 
exit 0

Set the owner and the permission:

 chown root.root /etc/init.d/BackupPC
 chmod 754 /etc/init.d/BackupPC

For the autostart there have to be set some symlinks into the runlevel:

 ln -s /etc/init.d/BackupPC /etc/rc.d/rc3.d/S51BackupPC
 ln -s /etc/init.d/BackupPC /etc/rc.d/rc6.d/K01BackupPC
 ln -s /etc/init.d/BackupPC /etc/rc.d/rc0.d/K01BackupPC

Now you can start the service with:

 /etc/init.d/BackupPC start

So that the service indicates over the webinterface “status → services → addon-services” a file needs to be created:

 touch /opt/pakfire/db/installed/meta-BackupPC

Setup BackupPC´s webinterface

The webinterface is running on a virtual host. Create a file named BackupPC.conf into /etc/httpd/conf/vhosts.d the file should contain the following content:

touch /etc/httpd/conf/vhosts.d/BackupPC.conf
File: /etc/httpd/conf/vhosts.d/BackupPC.conf
Listen 1009
 
<VirtualHost *:1009>
 
    DocumentRoot /srv/web/backuppc/
    Alias /images /srv/web/backuppc/images
    ScriptAlias /cgi-bin /srv/web/backuppc/cgi-bin
    <Directory /srv/web/backuppc/cgi-bin>
        AllowOverride None
        Options ExecCGI
    </Directory>
    <Directory /srv/web/backuppc/images>
        AllowOverride None
        Options None
    </Directory>
 
setenv REMOTE_USER backuppc
</VirtualHost>

Set the owner and the permission:

 chown root.root /etc/httpd/conf/vhosts.d/BackupPC.conf
 chmod 644 /etc/httpd/conf/vhosts.d/BackupPC.conf

Thereby there will be no user query generated and the access is for now on available! For a regular operation restrict the access rights! In here it concerns firstly that it runs.

To make the changes effective and to activate BackupPC´s web interface, restart the Apache Web server. This is done with a:

/etc/init.d/apache restart

Since now you can reach the webinterface under http://ipfire:1009/cgi-bin/BackupPC_Admin .

To get the full admin-interface, you must adapt the following line in /etc/BackupPC/config.pl :

 $conf{CgiAdminUsers} = 'backuppc'

Now you should see further entries on the left side.

Setup Rsync as a service on a Windows PC

With the SMB protocol, you can save Windows machines with BackupPC. Therefor create some shares on Windows machine. Since the Home Edition does not provide administrative shares, you can not work on these computers with “invisible” shares. Also, the performance of the SMB protocol Protocol are worser than that of the rsync protocol. So it makes sense on Windows computers to install rsync as a service. Then, BackupPC can automatically make the backup´s if the computer is turned on.

What is necessary so that rsync runs on Windows as a service?

  • cygwin dlls and rsync.exe
  • Instsrv and srvany from Windows Ressource Kit
  • a configuration file for rsync
  • some keys for the registry

First we apply a directory named “Rsync” in C:\Program (in Vista it is C:\Program Files). In there, we unpack this archiv . But still we missing “servant” and “instsrv”. Bent Norris offers on his side an English description, how-to set up rsync as a service and also an archive with the two files to download. These one´s we extract in the rsync directory. Now the following files should be in the directory:

  • cygiconv-2.dll
  • cygwin1.dll
  • instsrv.exe
  • rsync-param.reg
  • rsync.exe
  • rsyncd.conf
  • SRVANY.EXE

The two dlls must now be placed in a directory which is in the path. eg c:\\windows\\system32 . So move or copy them with the Explorer in there. In order to install rsync as a service, “srvany” needs to be registered as a service from rsync. We do this with the command:

 instsrv Rsync "C:\Programme\rsync\srvany.exe" 

We have now registered a service rsync, which executes the file srvany.exe . Now we have to say “srvany” what service we actually want to run. For this we edit the file rsync-param.reg and execute it afterwards. Adapt here the path to rsync.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Rsync\Parameters]
"AppDirectory"="\"C:\\Program Files\\rsync\""
"Application"="\"C:\\Program Files\\rsync\\rsync.exe\""
"AppParameters"="--config=\"C:\\Program Files\\rsync\\rsyncd.conf\" --daemon --no-detach"

If this is done, we can start the service. For this purpose we use “Control Panel → Administrative tools → services” and locate the service Rsync. By double-clicking, the properties are opening. In the tab “register” choose the local system account as the user.

The service is now ready and can be launched.

Which drives and directories can be accessed must be defined in the rsync.conf .

File: rsync.conf
use chroot = false
strict modes = false
hosts allow = 192.168.0.1                       <--- Enter IPFire´s IP
log file = c:/Program Files/rsync/rsyncd.log
 
[System]                                        <--- Register in BackupPC under RsyncShareName
path = /cygdrive/c/                             <--- Drive C
read only = yes 
 
[Data]                                         <--- Register in BackupPC under RsyncShareName
path = /cygdrive/d/                             <--- Drive D
read only = yes

If a firewall is running, open up the port 873 . If you want to use BackupPC over IPFire´s webinterface, this wiki might be interesting for you.

addons/backuppc/start.txt · Last modified: 2018/09/21 02:22 by Jon