Differences

This shows you the differences between the selected revision and the current version of the page.

howto:backuppc 2008/05/26 18:34 howto:backuppc 2017/12/04 19:29 current
Line 1: Line 1:
====== HOWTO Install BackupPC ====== ====== HOWTO Install BackupPC ======
-[[http://backuppc.sourceforge.net/info.html|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.+[[http://backuppc.sourceforge.net/info.html|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. The accompanying forum thread is located [[http://forum.dsmg600.info/t2264-BackupPC-DNS-323-running-working.html|here]]. \\ For a Wikipedia description click [[http://en.wikipedia.org/wiki/Backuppc|here]]. 
 + 
===== Requirements ===== ===== Requirements =====
Line 22: Line 24:
    cd /mnt/HD_a2     cd /mnt/HD_a2
    rsync -av inreto.de::dns323/fun-plug/0.5/packages .     rsync -av inreto.de::dns323/fun-plug/0.5/packages .
 +    rsync -av inreto.de::dns323/fun-plug/0.5/extra-packages/All/perl* .
    cd packages     cd packages
    funpkg -i *.tgz     funpkg -i *.tgz
This should get all the required programs installed except for BackupPC This should get all the required programs installed except for BackupPC
 +
 +
 +===== Create backuppc user =====
 +Create user and homedirectory
 +
 +  useradd -m backuppc
 +
 +To not lose user by reboot - store password permanently
 +
 +  store-passwd.sh
 +
 +
 +===== Installing Extra Perl Modules =====
 +
 +When I first made this page, I didn't remember having to do this step, but I've since set up another DNS-323 for someone else and I had to do this.  So I think these steps are required.  Let me know of the forum page if you find differently.
 +
 +So let's install File::RsyncP and Compress::Zlib.  Compress::Zlib isn't required and I haven't used it or tested it because my drives are large enough that I don't really need the compression.  One of these days I'll test it out I'm sure.
 +
 +The page for File::RsyncP is located [[http://search.cpan.org/dist/File-RsyncP/lib/File/RsyncP.pm|here]] and here's the steps for installing:
 +
 +  cd /mnt/HD_a2/ffp/tmp/
 +  wget http://search.cpan.org/CPAN/authors/id/C/CB/CBARRATT/File-RsyncP-0.68.tar.gz
 +  tar zxvf File-RsyncP-0.68.tar.gz
 +  cd File-RsyncP-0.68/
 +  perl Makefile.PL
 +  make
 +  make test
 +  make install
 + 
 +The same is done for Compress::Zlib located [[http://search.cpan.org/~pmqs/Compress-Zlib-2.011/lib/Compress/Zlib.pm|here]],
 +but you're going to have to install all of the prerequisites as well:
 + 
 +  Compress::Raw::Zlib
 +  IO::Compress::Base
 +  IO::Compress::Base::Common
 +  IO::Compress::Gzip
 +  IO::Compress::Gzip::Constants
 +  IO::Uncompress::Base
 +  IO::Uncompress::Gunzip
 +
 +I don't think this is difficult, just time consuming. However, if you're lazy and trust the perl automatic installer, you can run:
 +
 +  for N in Compress::Raw::Zlib IO::Compress::Base IO::Compress::Base::Common IO::Compress::Gzip IO::Compress::Gzip::Constants IO::Uncompress::Base IO::Uncompress::Gunzip
 +    do perl -MCPAN -e "install $N"
 +  done
 +
Line 37: Line 86:
  perl configure.pl   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!+Some of these questions will be different if you have a previous install.  If you have a previous install and you're trying to complete redo everything, you need to remove you old /etc/BackupPC/config.pl file 
 + 
 +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! 
 + 
 +Whatever is in the brackets [] is the default option and you can just press enter.
Go through the configure options Go through the configure options
 +  Full path to existing main config.pl []? Press enter
  Are these paths correct? [y]? y   Are these paths correct? [y]? y
-  BackupPC will run on host []? YOUR HOSTNAME HERE  (at the prompt, it says root@HOSTNAME+  BackupPC will run on host [...]? your HOSTNAME here (it's probably already the default answer
-  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)+  BackupPC should run as user [backuppc]?
  Install directory (full path) [...]? /ffp/usr/BackupPC   Install directory (full path) [...]? /ffp/usr/BackupPC
  Data directory (full path) []? /ffp/backuppcdata   Data directory (full path) []? /ffp/backuppcdata
 +  Compression level [0]?
  CGI bin directory (full path) []? /mnt/HD_a2/www/pages/cgi-bin   CGI bin directory (full path) []? /mnt/HD_a2/www/pages/cgi-bin
  Apache image directory (full path) []? /mnt/HD_a2/www/pages/BackupPC   Apache image directory (full path) []? /mnt/HD_a2/www/pages/BackupPC
-  URL for image directory (omit http://host; starts with '/') []? /BackupPC]+  URL for image directory (omit http://host; starts with '/') []? /BackupPC
And it's now going to say: And it's now going to say:
Line 58: Line 113:
  Do you want to continue? [y]? y   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:+If you have no errors here (I got a PING error, but I don't think it's breaking anything) 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 copy the /etc/BackupPC/ to the hard drive just make a symbolic link:
 +  mv /etc/BackupPC/ /mnt/HD_a2/ffp/etc/
  ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/   ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/
Line 71: Line 127:
Another option is to create a startup script and put it in the /mnt/HD_a2/ffp/start/ directory Another option is to create a startup script and put it in the /mnt/HD_a2/ffp/start/ directory
 +
 +The script below works for me, if you use it you should of course NOT add the 2 lines mentioned above to the end of the fun_plug
 +
 +  #!/bin/sh
 + 
 +  # PROVIDE: backuppc
 +  # REQUIRE: DAEMON
 +  # BEFORE:  LOGIN
 +  # KEYWORD: shutdown
 + 
 +  . /ffp/etc/ffp.subr
 + 
 +  name="backuppc"
 +  start_cmd="backuppc_start"
 +  restart_cmd="backuppc_restart"
 +  stop_cmd="backuppc_stop"
 +  status_cmd="backuppc_status"
 + 
 +  backuppc_start()
 +  {
 +      ln -s /mnt/HD_a2/ffp/etc/BackupPC /etc/
 +      # If you run BackupPC under user root you don't need these commented lines,
 +      # otherwise you're smart enough to figure out why I have them in my config ;-)
 +      # ln -s /mnt/HD_a2/ffp/var/log/BackupPC /var/log/
 +      # su - backuppc -s /bin/sh -c '/mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d'
 +      /mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d
 +      echo "${name} started"
 +  }
 + 
 +  backuppc_restart()
 +  {
 +      backuppc_stop
 +      sleep 1
 +      backuppc_start
 +  }
 + 
 +  backuppc_stop()
 +  {
 +      /ffp/bin/pkill -f "/mnt/HD_a2/ffp/usr/BackupPC/bin/BackupPC -d"
 +      echo "${name} stopped"
 +  }
 + 
 +  backuppc_status()
 +  {
 +      if [ "`ps ax | grep "BackupPC -d" | grep perl`" = "" ] ; then
 +          echo "${name} not running"
 +      else
 +          echo "${name} running"
 +      fi
 +  }   
 + 
 + 
 +  extra_commands="status"
 +  run_rc_command "$1"
 +
 +
The last thing we need to do is fix the BackupPC_Admin 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: The last thing we need to do is fix the BackupPC_Admin 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:
Line 81: Line 193:
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 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
 +
Line 86: Line 199:
This section sets up Lighttpd to run perl scripts.  It probably should be a separate wiki page (feel free to fix that yourself) 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+Copy the example lighttpd.conf file then edit it 
 + 
 +  cd /mnt/HD_a2/ffp/etc/ 
 +  cp examples/lighttpd.conf . 
 + 
 +Now edit lighttpd.conf
In the "## modules to load" section uncomment the following line: In the "## modules to load" section uncomment the following line:
Line 101: Line 219:
      cgi.assign = ( ".pl" => "/mnt/HD_a2/ffp/bin/perl" )       cgi.assign = ( ".pl" => "/mnt/HD_a2/ffp/bin/perl" )
  }   }
-after the commented out line:+after the commented out section:
  #$HTTP["url"] =~ "\.pdf$" {   #$HTTP["url"] =~ "\.pdf$" {
 +
 +Make sure the log directory exists:
 +  mkdir /mnt/HD_a2/www/logs
Lighttpd should be configured, now go ahead and start it: Lighttpd should be configured, now go ahead and start it:
-  sh /mnt/HD_a2/ffp/start/lighttpd.sh+  sh /mnt/HD_a2/ffp/start/lighttpd.sh start
And set it to run on startup: And set it to run on startup:
  chmod a+x /mnt/HD_a2/ffp/start/lighttpd.sh   chmod a+x /mnt/HD_a2/ffp/start/lighttpd.sh
-You lighttpd should be good to go now.+Your 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: You can test it by creating a file, /mnt/HD_a2/www/pages/cgi-bin/sample.pl, that contains:
Line 122: Line 243:
And you should only see (with no other text!): And you should only see (with no other text!):
  Hi there! This is a sample perl program!!!   Hi there! This is a sample perl program!!!
 +
Line 127: Line 249:
This section can be a bit daunting, but just read the [[http://backuppc.sourceforge.net/faq/BackupPC.html|documentation]] carefully This section can be a bit daunting, but just read the [[http://backuppc.sourceforge.net/faq/BackupPC.html|documentation]] carefully
-The settings main configuration file (/mnt/HD_a2/ffp/etc/BackupPC/config.pl) should be set correctly for the most part.+The main settings 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: 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';   $Conf{XferMethod} = 'rsyncd';
-Now you need to set up the config files for each host:+Now you need to set up the config files for each host.  First you need to create the directory that the config files will be stored in: 
 + 
 +  mkdir /mnt/HD_a2/ffp/etc/BackupPC/pc/
-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:+Now you are ready to create the config file.  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{XferMethod} = 'rsyncd';
  $Conf{RsyncShareName} = 'docs'; #this setting must match a later file   $Conf{RsyncShareName} = 'docs'; #this setting must match a later file
Line 179: Line 303:
Now edit rsyncd.secrets and change UUU:PPP to the username and password that we entered above in the computer1.pl file: Now edit rsyncd.secrets and change UUU:PPP to the username and password that we entered above in the computer1.pl file:
  USERNAME:PASSWORD   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) Edit the service.bat file (you may have to use wordpad, gvim, notepad++, etc... instead of regular notepad to deal with the line breaks)
Line 202: Line 328:
Now you're ready to add more computers to be backed up to the server and edit your settings to your liking. Now you're ready to add more computers to be backed up to the server and edit your settings to your liking.
 +
 +
 +
===== Troubleshooting ===== ===== Troubleshooting =====
-"unknown host" error when starting a backup +== "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. This can happen if you have added a host to conf/hosts but forgotten to reload the config file.
 +Also, if you have a computer named computer1 and you can't do a ping computer1 and get a correct response (from the correct IP address), you may need to statically assign computer1's IP address (on computer1's machine) and then set up your /etc/hosts file give the IP address for computer1.
 +So edit the /etc/hosts file to add:
 +  192.168.xxx.xxx computer1 computer1
 +And to make this work on startup add to the end of your fun_plug file:
 +  echo "192.168.xxx.xxx computer1 computer1" >> /etc/hosts
 +
 +
 +Edited by PetoZ 4.1.2010.
 +
 +== backup aborted (inet connect: Connection timed out) ==
 +
 +Connection is blocked on firewall or rsyncd on client computer is not running.
 +
 +
 +== restore failed (Unable to read 4 bytes) ==
 +
 +To fix this change read only = false in c:/rsyncd/rsyncd.conf file on your client computer.
 +I tested it and it works on Windows XP Home and Professional.
 +
 +
 +
 +
 +
 +
 +
 +
 +
-/NOW 

Navigation

Personal Tools