This is an old revision of the document!


HOWTO Install BackupPC

BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain. It runs quite well on the DNS-323.

Requirements

  • This guide was done using v1.3 firmware on the DNS-323.
  • You will need fun_plug (I have only used v0.5) and use the wiki page to set that up
  • You'll need to be able to use an editor such as vim

Fun_Plug

You need to follow the directions here to get fun_plug working: http://www.inreto.de/dns323/fun-plug/0.5/

Fonz's fun_plug will set up perl, ssh, lighttpd, etc… I've highlighted the main bits.

Copy fun_plug and fun_plug.tgz to Volume 1 (using FTP) and reboot. 
If successful, the fun_plug.tgz file is unpacked (ffp directory)
and a telnet server is started.

Using rsync, you can download and install additional packages with:

  telnet <your hostname or IP address>
  cd /mnt/HD_a2
  rsync -av inreto.de::dns323/fun-plug/0.5/packages .
  cd packages
  funpkg -i *.tgz

This should get all the required programs installed except for BackupPC

Compiling and Installing BackupPC

Download BackupPC (v3.1.0): http://sourceforge.net/project/showfiles.php?group_id=34854

cd /mnt/HD_a2/ffp/tmp
wget http://internap.dl.sourceforge.net/sourceforge/backuppc/BackupPC-3.1.0.tar.gz
tar zxvf BackupPC-3.1.0.tar.gz
cd BackupPC-3.1.0
perl configure.pl

I think I've missed some of the questions that come up in this next section, such as the ones about compression. I didn't enable compression since 500 GB (on RAID 1) is well enough for me and I wasn't sure how well the DNS-323 would handle doing compression, but I suspect it would handle it well enough. Also, most of my files are jpeg images which aren't going to receive much benefit from compression. So enable it if you like and give us your results at the bottom!

Go through the configure options

Are these paths correct? [y]? y
BackupPC will run on host []? YOUR HOSTNAME HERE  (at the prompt, it says root@HOSTNAME)
BackupPC should run as user [backuppc]? root (I used root here to make things easier, but it's better to create a limited user named backuppc)
Install directory (full path) [...]? /ffp/usr/BackupPC
Data directory (full path) []? /ffp/backuppcdata
CGI bin directory (full path) []? /mnt/HD_a2/www/pages/cgi-bin
Apache image directory (full path) []? /mnt/HD_a2/www/pages/BackupPC
URL for image directory (omit http://host; starts with '/') []? /BackupPC]

And it's now going to say:

Ok, we're about to:

  - install the binaries, lib and docs in /ffp/usr/BackupPC,
  - create the data directory /ffp/backuppcdata,
  - create/update the config.pl file /etc/BackupPC/config.pl,
  - optionally install the cgi-bin interface.
Do you want to continue? [y]? y

If you have no errors here then BackupPC is installed, but we have to fix a couple of items. The location for the /etc (/etc/BackupPC/config.pl) will not work, so let's just make a symbolic link:

ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/

And let's put these two lines at the end of the fun_plug so that they run on startup

ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/
/mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d

Or without an editor in two easy lines:

echo "ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/" >> /mnt/HD_a2/fun_plug
echo "/mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d" >> /mnt/HD_a2/fun_plug

Another option is to create a startup script and put it in the /mnt/HD_a2/ffp/start/ directory

The last thing we need to do is fix the BackupPC cgi script to work with lighttpd. This change isn't exactly necessary if your web server is properly configured, but I found this to be simple enough:

cd /mnt/HD_a2/www/pages/cgi-bin
ln -s BackupPC_Admin BackupPC_Admin.pl

Next change the first line of this file to:

#!/mnt/HD_a2/ffp/bin/perl

BackupPC is now installed and will run on startup, but it needs to be configured, and we need to fix lighttpd to run the BackupPC_Admin.pl perl file

Configuring Lighttpd

This section sets up Lighttpd to run perl scripts. It probably should be a separate wiki page (feel free to fix that yourself)

Edit the file /mnt/HD_a2/ffp/etc/lighttpd.conf

In the ”## modules to load” section uncomment the following line: “mod_cgi”, And make sure your config file has these settings:

server.document-root = "/mnt/HD_a2/www/pages/"
server.errorlog = "/mnt/HD_a2/www/logs/error.log"
accesslog.filename = "/mnt/HD_a2/www/logs/access.log"
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
server.port = 8080

Add the following lines:

$HTTP["url"] =~ "/cgi-bin/" {
    cgi.assign = ( ".pl" => "/mnt/HD_a2/ffp/bin/perl" )
}

after the commented out line:

#$HTTP["url"] =~ "\.pdf$" {

Lighttpd should be configured, now go ahead and start it:

sh /mnt/HD_a2/ffp/start/lighttpd.sh

And set it to run on startup:

chmod a+x /mnt/HD_a2/ffp/start/lighttpd.sh

You lighttpd should be good to go now.

You can test it by creating a file, /mnt/HD_a2/www/pages/cgi-bin/sample.pl, that contains:

#!/mnt/HD_a2/ffp/bin/perl
print "Content-Type: text/plain", "\n\n";
print "Hi there! This is a sample perl program!!!", "\n";

Open your browser and navigate to:

http://192.168.0.32:8080/cgi-bin/sample.pl

And you should only see (with no other text!):

Hi there! This is a sample perl program!!!

Configuring BackupPC

This section can be a bit daunting, but just read the documentation carefully

The settings main configuration file (/mnt/HD_a2/ffp/etc/BackupPC/config.pl) should be set correctly for the most part.

There are several methods for backup, but I'm doing windows machines and using rsyncd, so change this line the in config.pl file:

$Conf{XferMethod} = 'rsyncd';

Now you need to set up the config files for each host:

So, for a host with the name, computer1, you would edit the file /mnt/HD_a2/ffp/etc/BackupPC/pc/computer1.pl and put in:

$Conf{XferMethod} = 'rsyncd';
$Conf{RsyncShareName} = 'docs'; #this setting must match a later file
$Conf{RsyncdUserName} = 'SOMEUSERNAME'; #remember this username and password for a later file
$Conf{RsyncdPasswd} = 'SOMEPASSWORD';

# this line is optional but helps get rid of transfer errors in your log files while backing up 
# in addition to not backing up some unnecessary temp and cache files
$Conf{BackupFilesExclude} = [
 '*parent.lock',
 '*UsrClass.dat*',
 '*Firefox*Cache*',
 '*Local Settings/Temp*',
 'NTUSER.DAT',
 'ntuser.dat.LOG'
];

Now edit the file /mnt/HD_a2/ffp/etc/BackupPC/hosts and add to the bottom:

computer1  0  root

BackupPC should be ready to backup computer1, but we need to prepare computer1 with a client rsyncd

But now that you've edited the hosts file, you need to restart the BackupPC service:

killall BackupPC
/mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d

Configuring a Host for Backup

Download rsyncd (cygwin-rsyncd-2.6.8_0.zip) for Windows from the BackupPC website (hosted by SourceForge).

Unzip the files to c:\rsyncd

Edit the rsyncd.conf file and edit the docs section to your liking, such as:

[docs]
  path = c:/Documents and Settings
  comment = Documents and Settings
  strict modes = false
  auth users = USERNAME #this USERNAME comes from the computer1.pl file that we edited before
  secrets file = c:/rsyncd/rsyncd.secrets
  read only = true
  list = false

Now edit rsyncd.secrets and change UUU:PPP to the username and password that we entered above in the computer1.pl file:

USERNAME:PASSWORD

Edit the service.bat file (you may have to use wordpad, gvim, notepad++, etc… instead of regular notepad to deal with the line breaks)

You only need to edit this file if you need to remove the “rem ” from the last three lines to allow it to punch through the windows firewall

So after editing it, run service.bat

Web Admin

Alright, if everything has gone properly, you should be able to start backing up.

Access the web admin through:

http://192.168.0.32:8080/cgi-bin/BackupPC_Admin.pl

You should now see computer1 (or whatever your host-to-be-backed-up's name is) in the drop down

You should be able to “Start Full Backup” and not get any errors

My first full backup took 8.5 hrs for 53086 files that totaled 47 GB so that averages out to 1.54 MB/sec. Do keep in mind that the server is not transferring files the whole time, but is also doing other processes as well. Your average transfer speed will vary depending on the number of files you have, etc… For individual files the server was transferring at very high speeds (10+ MB/s over gigabit, sorry I don't have an exact number).

Anyway, subsequent backups (incremental backups) will not transfer as many files, but the server will still take awhile to rsync all of those files. So one incremental backup that transferred only 300 MB or so took 26 minutes.

Now you're ready to add more computers to be backed up to the server and edit your settings to your liking.

Troubleshooting

“unknown host” error when starting a backup

This can happen if you have added a host to conf/hosts but forgotten to reload the config file.

/NOW


Navigation

Personal Tools