NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
bart_stevens
Nov 27, 2013Aspirant
BackupPC working on ReadyNAS 2100
got finally backuppc working on Readynas 2100 ... (and installed in the mean time an extra perl + apache2 with mod_perl)
I was also able to get it work on a NV+ ... but that was a bit too slow
this is my first post, so bear with me ;-)
warning: it takes hours to follow this guide.
intro
First of all I like to thank Craig Barrat for making this great piece of software freely available to the public. And of course a big thanks to all the people involved in all the open source projectts used to accomplish the whole setup!!
I'm not at all a unix guru. I've used a lot of info on different forums and of course there will be better ways to do what I did. I have no doubts that there will be a lot of improving possibilities.
It would be great if one of those Readynas guru's could make a backuppc add-on
My setup:
just a stock readynas 2100, named 'nas_zolder', having the ip address 192.168.3.101. It is connected to the internet. I did a fresh factory reinstall to make sure that this howto was representative. My goal was to leave the standard system (with frontview etc.) as much as possible intact, so I choose to install a second apache with a brand new perl etc. on an other location and on a different port of course. This to ensure that I don't mess up for example frontview.
With a few adjustments, this howto is also quite applicable for other Netgear NAS.
remarks:
* don't blame me if you mess up your system: I strongly recommend to use a ReadyNAS with no important data or configuration that you can't easily restore!
* this howto takes quite some time: while doing the make && make install of the larger programs like Perl & Apache (it takes hours). You don't need to wait behind the screen during these. I skipped in this tutorial make test mostly ... feel free to do it
* the links I refer to, were valid at the time of writing this. They will be outdated most probably in the near future.
* my goal was also to install mod_perl ... but that failed again and again ... until I downgraded to an older apache version: 2.2. Apparently the current mod_perl don't want to play nicely with Apache 2.4
mod_perl gives a great performance boast for the admin interface of BackupPC
Overview
1. preparations
2. user & basedir
3. perl
4. additional perl modules
5. apache2
6. nmblookup
7. backuppc
8. clean up
1. Preparations
* FYI:
Readynas 2100 security level is at my place 'users' (not shares), see frontview security tab
I upgraded to the latest stable version: RAIDiator 4.2.24 (x86) from July 5, 2013 (this takes a bit of time)
* Setting up a ReadyNAS Development Environment
upgrade to the most recent stable version of Radiator and install the 'The EnableRootSSH addon'
-> after the installation of this add on, you should be able to ssh into your machine as 'root' with the admin password:
when he requests a password: this is your admin password used in frontview (if this is not working try netgear1).
If you get 'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED', this most probably means that you have made in the past a ssh connection to this ip address `
-> you should manually edit the .ssh/known_hosts file (or wherever this known_hosts file resides) and delete the entry for the same ip address
when you have entered the shell, issue the following commands:
note: with vi you can edit text files, however it doesn't have gui and you need to remember the following:
when you want to start typing: press the esc key and press 'i'
to close a file without saving: press the esc key and type ':q!'
to save and close a file: press the esc key and type ':wq'
-> see also http://www.lagmonster.org/docs/vi.html for more info
2. create user backuppc & basedir
you need to give also name etc for this new user, but you can just press enter
the systems gives you feedback about the adduser action: notice the uid for the user and the group (1002 in my casewith a fresh factory reset).
the backuppc user belongs automatically to the group backuppc.
Adding new group `backuppc' (1000) ...
Adding new user `backuppc' (1002) with group `backuppc' ...
now you can changeover to the backuppc user by
go back to the root user
make the basedir for the BackupPC program and data
go into frontview and make a new share named 'backuppc_share'
this will have the location /c/backuppc_share, but a symbolic link 'backuppc_share' is made directly at the root
you need to create a share and not a usual dir below the root for backuppc, otherwise the filesystem of the NAS gets completely filled in no time
(you can see this with the command df -h)
3. perl
get the source code (see http://www.cpan.org/src/README.html for the actual latest status and follow the instructions):
Most likely you don't want perl-support for threads enabled, that's why -Uusethreads instead of -Dusethreads.
the following command takes a real long time ... don't stay looking at the screen unless yo really have spare time
check if the files perl and cpan exist in the perl/bin dir, if not create the following symbolic links:
notice the difference in output between the following 2 commands:
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
This is perl 5, version 18, subversion 1 (v5.18.1) built for i686-linux
4. additional perl modules
additional resources needed after on:
open cpan with the following command
in the cpan interface:
backuppc will need the following perl modules:
Compress::Zlib Archive::Zip File::RsyncP
(you can add also RSS feeds, but the following installs take already quite some time ... certainly the first one, also because of the testing )
after this is finished you can quit the cpan shell with 'exit'
5. apache2
APR and APR-UTIL
get the locations of the source code for latest versions from http://apr.apache.org/download.cgi
get the source code for apr
get the source code for apr-util
!!! Apache 2.4 is at this moment not compatible with mod_perl -> max is Apache 2.2
APACHE && mod_perl
get the source code of apache2.2
You need to have Apache built and installed prior to building mod_perl, only if you intend build a DSO mod_perl.
If you have a static mod_perl it is the other way around
you cannot use mod_php (not thread safe) with worker MPM but can use with prefork MPM.
check mpm
or
you should get at the end:
[warning] mod_perl dso library will be built as mod_perl.so
[warning] You'll need to add the following to httpd.conf:
[warning]
[warning] LoadModule perl_module modules/mod_perl.so
[warning]
[warning] depending on your build, mod_perl might not live in
[warning] the modules/ directory.
[warning] Check the results of
[warning]
[warning] $ /c/backuppc_share/apache2/bin/apxs -q LIBEXECDIR
[warning]
[warning] and adjust the LoadModule directive accordingly.
check that mod_perl.so was made
changing the apache2 config file:
backup the original file
changes needed:
1- port 80 -> port 8080
original file around line 41: listen 80
new version: listen 8080
2- add after the Loadmodule section on Line 100
LoadModule perl_module modules/mod_perl.so
3- user as which this apache runs
original file (line 112):
User daemon
Group daemon
-> new version:
User backuppc
Group backuppc
4. add on line 145 below #ServerName www.example.com:80
ServerName 192.168.3.101:8080
5. activate mod_perl
there should be an alias created for cgi-bin on line 336
ScriptAlias /cgi-bin/ "/c/backuppc_share/apache2/cgi-bin/"
and on lines 315 you should include a bit more
<Directory "/c/backuppc_share/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
# add the following lines
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
# end of addition
</Directory>
save and close the file with typing :wq (after you hit the escape key)
Testing the cgi-bin dir:
total 16
drwxr-xr-x 2 root root 4096 Nov 27 12:49 .
drwxr-xr-x 14 root root 4096 Nov 27 12:49 ..
-rw-r--r-- 1 501 staff 294 Dec 11 2004 printenv
-rw-r--r-- 1 501 staff 779 Dec 11 2004 test-cgi
-> the actual scripts are not referring to our latest perl, let's make our own test
paste the following code:
and save this file
change the filemod
start apache:
check if the server is running by surfing to http://192.168.3.101:8080/
-> you should get an 'It Works' page
stop apache:
check if the server is working with mod_perl
start apache:
-> you should get an overview page with quite some info
making Apache start up automatically during booting
(startup script init.d: -> http://julmis.julmajanne.com/index.php/LAMP+on+Debian)
copy paste the following
On top of that you need to add it to the right run level. First we need to find out in which run level we are working
this should give N 2
Adding it to this run level at start up:
check if it is working:
stop apache to be sure it is not working already:
same thing should be possible by
/etc/init.d/apache2_backuppc start
/etc/init.d/apache2_backuppc stop
6. nmblookup
most probably you will get the answer '-bash: nmblookup: command not found'
for some reason nmblookup isn't part (yet) of the smbclient installation on my machine
installing this program only is not really well documented ;-)
I didn't want to interfere with the present samba setup, so I tried the following:
(the latest version of samba is version 4.x.x and I couldn't get it working easily, so i opted to choose a less recent version)
ONLY make !!!!! but this takes a real long time ...
find the newly created program
verify:
copy to /usr/bin/ dir:
7. backuppc
latest status was at time of writing this manual BackupPC-3.3.0.tar
first question = new install, so don't fill in a path, just hit return
second question -> ! change perl location during setup !!
--> Are these paths correct? [y]? n
-> perl: /c/backuppc_share/perl/bin/perl
don't forget to change the following config info too:
Install Directory: /c/backuppc_share/prog
data directory: /c/backuppc_share/data
CGI bin Directory: /c/backuppc_share/apache2/cgi-bin
Apache image Directory: /c/backuppc_share/apache2/htdocs/BackupPC
URL for image directory (omit http://host; starts with '/') []? /BackupPC
for the other questions just accept the proposed values
... rest of the installation should go smoothly
after the installation:
make sure that the user backuppc owns /c/backuppc_share/prog/bin
if backuppc is not the owner of everything ->
make the BackupPC_Admin script executable
make the init.d file work for automatic startup of backuppc during boot cycle:
for me this was however not working, I changed the init.d script for backuppc as followed:
than to make sure this backuppc init.d scripts starts
nas_zolder:/# cd /etc/init.d
nas_zolder:/etc/init.d# chmod 751 ./backuppc
nas_zolder:/etc/init.d# /usr/sbin/update-rc.d backuppc start 30 2 3 4 5 6 . stop 80 0 1 .
to make temporarly the admin interface available for everyone, later on you change the complete config through the web admininterface
$Conf{CgiAdminUsers} = '*';
save with :wq
start up apache if it is not running (check http://192.168.3.101:8080 in my case)
start up backuppc
alternative way to start backuppc:
check if the program BackupPC is running
to access the admin interface, browse with another computer to:
http://192.168.3.101:8080/cgi-bin/BackupPC_Admin
8. clean up
. perl
. apache2
. mod_perl
. nmblookup
. backuppc
I was also able to get it work on a NV+ ... but that was a bit too slow
this is my first post, so bear with me ;-)
warning: it takes hours to follow this guide.
intro
First of all I like to thank Craig Barrat for making this great piece of software freely available to the public. And of course a big thanks to all the people involved in all the open source projectts used to accomplish the whole setup!!
I'm not at all a unix guru. I've used a lot of info on different forums and of course there will be better ways to do what I did. I have no doubts that there will be a lot of improving possibilities.
It would be great if one of those Readynas guru's could make a backuppc add-on
My setup:
just a stock readynas 2100, named 'nas_zolder', having the ip address 192.168.3.101. It is connected to the internet. I did a fresh factory reinstall to make sure that this howto was representative. My goal was to leave the standard system (with frontview etc.) as much as possible intact, so I choose to install a second apache with a brand new perl etc. on an other location and on a different port of course. This to ensure that I don't mess up for example frontview.
With a few adjustments, this howto is also quite applicable for other Netgear NAS.
remarks:
* don't blame me if you mess up your system: I strongly recommend to use a ReadyNAS with no important data or configuration that you can't easily restore!
* this howto takes quite some time: while doing the make && make install of the larger programs like Perl & Apache (it takes hours). You don't need to wait behind the screen during these. I skipped in this tutorial make test mostly ... feel free to do it
* the links I refer to, were valid at the time of writing this. They will be outdated most probably in the near future.
* my goal was also to install mod_perl ... but that failed again and again ... until I downgraded to an older apache version: 2.2. Apparently the current mod_perl don't want to play nicely with Apache 2.4
mod_perl gives a great performance boast for the admin interface of BackupPC
Overview
1. preparations
2. user & basedir
3. perl
4. additional perl modules
5. apache2
6. nmblookup
7. backuppc
8. clean up
1. Preparations
* FYI:
Readynas 2100 security level is at my place 'users' (not shares), see frontview security tab
I upgraded to the latest stable version: RAIDiator 4.2.24 (x86) from July 5, 2013 (this takes a bit of time)
* Setting up a ReadyNAS Development Environment
upgrade to the most recent stable version of Radiator and install the 'The EnableRootSSH addon'
-> after the installation of this add on, you should be able to ssh into your machine as 'root' with the admin password:
ssh root@192.168.3.101first he asks if you are sure to connect -> type 'yes'
when he requests a password: this is your admin password used in frontview (if this is not working try netgear1).
If you get 'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED', this most probably means that you have made in the past a ssh connection to this ip address `
-> you should manually edit the .ssh/known_hosts file (or wherever this known_hosts file resides) and delete the entry for the same ip address
when you have entered the shell, issue the following commands:
nas_zolder:~# cd /remove the # before the line deb http://archive.debian.org/debian etch main and save the file
nas_zolder:/# cd /etc/apt
nas_zolder:/etc/apt# vi sources.list
note: with vi you can edit text files, however it doesn't have gui and you need to remember the following:
when you want to start typing: press the esc key and press 'i'
to close a file without saving: press the esc key and type ':q!'
to save and close a file: press the esc key and type ':wq'
-> see also http://www.lagmonster.org/docs/vi.html for more info
nas_zolder:/# apt-get update
nas_zolder:/# apt-get install coreutils gcc bison make libc6-dev g++
2. create user backuppc & basedir
nas_zolder:/# adduser backuppc-> type two times the same password
you need to give also name etc for this new user, but you can just press enter
the systems gives you feedback about the adduser action: notice the uid for the user and the group (1002 in my casewith a fresh factory reset).
the backuppc user belongs automatically to the group backuppc.
Adding new group `backuppc' (1000) ...
Adding new user `backuppc' (1002) with group `backuppc' ...
now you can changeover to the backuppc user by
nas_zolder:/# su backuppc
go back to the root user
backuppc@nas_zolder:/$ su root
make the basedir for the BackupPC program and data
go into frontview and make a new share named 'backuppc_share'
this will have the location /c/backuppc_share, but a symbolic link 'backuppc_share' is made directly at the root
you need to create a share and not a usual dir below the root for backuppc, otherwise the filesystem of the NAS gets completely filled in no time
(you can see this with the command df -h)
3. perl
get the source code (see http://www.cpan.org/src/README.html for the actual latest status and follow the instructions):
nas_zolder:/etc/apt# cd /
nas_zolder:/# wget http://www.cpan.org/src/5.0/perl-5.18.1.tar.gz
nas_zolder:/# tar -xzf perl-5.18.1.tar.gz
nas_zolder:/# cd perl-5.18.1
nas_zolder:/perl-5.18.1# ./Configure -des -Dprefix=/c/backuppc_share/perl -Dcc=gcc -Uusethreads -Doptimize='-g' -Dusedevel
Most likely you don't want perl-support for threads enabled, that's why -Uusethreads instead of -Dusethreads.
the following command takes a real long time ... don't stay looking at the screen unless yo really have spare time
nas_zolder:/perl-5.18.1# make
nas_zolder:/perl-5.18.1# make install
check if the files perl and cpan exist in the perl/bin dir, if not create the following symbolic links:
nas_zolder:/perl-5.18.1# cd /c/backuppc_share/perl/bin/-> see if you can find the files perl and cpan, if not:
nas_zolder:/c/backuppc_share/perl/bin# ls -l
nas_zolder:/c/backuppc_share/perl/bin# ln -s ./perl5.18.1 ./perl
nas_zolder:/c/backuppc_share/perl/bin# ln -s ./cpan5.18.1 ./cpan
notice the difference in output between the following 2 commands:
nas_zolder:/c/backuppc_share/perl/bin# perl -v-> this is the readynas standard perl:
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
nas_zolder:/c/backuppc_share/perl/bin# ./perl -v-> this is the version you just installed:
This is perl 5, version 18, subversion 1 (v5.18.1) built for i686-linux
4. additional perl modules
additional resources needed after on:
open cpan with the following command
nas_zolder:/c/backuppc_share/perl/bin# ./cpan-> cpan config starts, choose the std answers
in the cpan interface:
install CPAN
reload cpan
backuppc will need the following perl modules:
Compress::Zlib Archive::Zip File::RsyncP
(you can add also RSS feeds, but the following installs take already quite some time ... certainly the first one, also because of the testing )
install Compress::Zlib
install Archive::Zip
install File::Listing
install File::RsyncP
after this is finished you can quit the cpan shell with 'exit'
5. apache2
nas_zolder:/c/backuppc_share/perl/bin# cd /
APR and APR-UTIL
get the locations of the source code for latest versions from http://apr.apache.org/download.cgi
get the source code for apr
nas_zolder:/# wget http://apache.cu.be//apr/apr-1.5.0.tar.gz
nas_zolder:/# tar -xzf apr-1.5.0.tar.gz
nas_zolder:/# mkdir /c/backuppc_share/srclib
nas_zolder:/# mv ./apr-1.5.0 /c/backuppc_share/srclib/apr
nas_zolder:/# cd /c/backuppc_share/srclib/apr
nas_zolder:/c/backuppc_share/srclib/apr# ./configure
nas_zolder:/c/backuppc_share/srclib/apr# make
nas_zolder:/c/backuppc_share/srclib/apr# make install
get the source code for apr-util
nas_zolder:/c/backuppc_share/srclib/apr# cd /
nas_zolder:/# wget http://apache.cu.be//apr/apr-util-1.5.3.tar.gz
nas_zolder:/# tar -xzf apr-util-1.5.3.tar.gz
nas_zolder:/# mv ./apr-util-1.5.3 /c/backuppc_share/srclib/apr-util
nas_zolder:/# cd /c/backuppc_share/srclib/apr-util
nas_zolder:/c/backuppc_share/srclib/apr-util# ./configure --with-apr=/c/backuppc_share/srclib/apr
nas_zolder:/c/backuppc_share/srclib/apr-util# make
nas_zolder:/c/backuppc_share/srclib/apr-util# make install
!!! Apache 2.4 is at this moment not compatible with mod_perl -> max is Apache 2.2
APACHE && mod_perl
get the source code of apache2.2
nas_zolder:/c/backuppc_share/srclib/apr-util# cd /
nas_zolder:/# wget http://apache.belnet.be//httpd/httpd-2.2.26.tar.gz
nas_zolder:/# tar -xzf httpd-2.2.26.tar.gz
You need to have Apache built and installed prior to building mod_perl, only if you intend build a DSO mod_perl.
If you have a static mod_perl it is the other way around
nas_zolder:/# cd httpd-2.2.26
you cannot use mod_php (not thread safe) with worker MPM but can use with prefork MPM.
nas_zolder:/httpd-2.2.26# ./configure --prefix=/c/backuppc_share/apache2 --enable-module=shared --with-apr=/c/backuppc_share/srclib/apr --with-apr-util=/c/backuppc_share/srclib/apr-util --enable-so --with-mpm=prefork --with-perl=/c/backuppc_share/perl/bin/perl --enable-mods-shared=most
nas_zolder:/httpd-2.2.26# make
nas_zolder:/httpd-2.2.26# make install
check mpm
nas_zolder:/httpd-2.2.26# /c/backuppc_share/apache2/bin/httpd -V | grep MPM-> should give: Server MPM: Prefork
or
nas_zolder:/httpd-2.2.26# /c/backuppc_share/apache2/bin/httpd -Vto see a lot more info on this apache install
nas_zolder:/httpd-2.2.26# cd /
nas_zolder:/# wget http://apache.org/dist/perl/mod_perl-2.0.8.tar.gz
nas_zolder:/# tar -xvzf mod_perl-2.0.8.tar.gz
nas_zolder:/# cd mod_perl-2.0.8
nas_zolder:/mod_perl-2.0.8# /c/backuppc_share/perl/bin/perl ./Makefile.PL MP_APXS=/c/backuppc_share/apache2/bin/apxs MP_APR_CONFIG=/c/backuppc_share/srclib/apr/apr-1-config
you should get at the end:
[warning] mod_perl dso library will be built as mod_perl.so
[warning] You'll need to add the following to httpd.conf:
[warning]
[warning] LoadModule perl_module modules/mod_perl.so
[warning]
[warning] depending on your build, mod_perl might not live in
[warning] the modules/ directory.
[warning] Check the results of
[warning]
[warning] $ /c/backuppc_share/apache2/bin/apxs -q LIBEXECDIR
[warning]
[warning] and adjust the LoadModule directive accordingly.
nas_zolder:/mod_perl-2.0.8# make
nas_zolder:/mod_perl-2.0.8# make install
check that mod_perl.so was made
nas_zolder:/mod_perl-2.0.8# find /c/backuppc_share -name mod_perl.so-> should give /c/backuppc_share/apache2/modules/mod_perl.so
changing the apache2 config file:
nas_zolder:/httpd-2.4.7# cd /c/backuppc_share/apache2/conf
backup the original file
nas_zolder:/c/backuppc_share/apache2/conf# cp httpd.conf httpd_orig.confedit the file
nas_zolder:/c/backuppc_share/apache2/conf# vi httpd.conf
changes needed:
1- port 80 -> port 8080
original file around line 41: listen 80
new version: listen 8080
2- add after the Loadmodule section on Line 100
LoadModule perl_module modules/mod_perl.so
3- user as which this apache runs
original file (line 112):
User daemon
Group daemon
-> new version:
User backuppc
Group backuppc
4. add on line 145 below #ServerName www.example.com:80
ServerName 192.168.3.101:8080
5. activate mod_perl
there should be an alias created for cgi-bin on line 336
ScriptAlias /cgi-bin/ "/c/backuppc_share/apache2/cgi-bin/"
and on lines 315 you should include a bit more
<Directory "/c/backuppc_share/apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
# add the following lines
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
# end of addition
</Directory>
save and close the file with typing :wq (after you hit the escape key)
Testing the cgi-bin dir:
nas_zolder:/c/backuppc_share/apache2/conf# cd /c/backuppc_share/apache2/cgi-bin-> you see most probably this
nas_zolder:/c/backuppc_share/apache2/cgi-bin# ls -a -l
total 16
drwxr-xr-x 2 root root 4096 Nov 27 12:49 .
drwxr-xr-x 14 root root 4096 Nov 27 12:49 ..
-rw-r--r-- 1 501 staff 294 Dec 11 2004 printenv
-rw-r--r-- 1 501 staff 779 Dec 11 2004 test-cgi
-> the actual scripts are not referring to our latest perl, let's make our own test
nas_zolder:/c/backuppc_share/apache2/cgi-bin# vi my_test
paste the following code:
#!/c/backuppc_share/perl/bin/perl
# test.cgi by Bill Weinman [http://bw.org/]
# Copyright 1995-2008 The BearHeart Group, LLC
# Free Software: Use and distribution under the same terms as perl.
use strict;
use warnings;
use CGI;
print foreach (
"Content-Type: text/plain\n\n",
"BW Test version 5.0\n",
"Copyright 1995-2008 The BearHeart Group, LLC\n\n",
"Versions:\n=================\n",
"perl: $]\n",
"CGI: $CGI::VERSION\n"
);
my $q = CGI::Vars();
print "\nCGI Values:\n=================\n";
foreach my $k ( sort keys %$q ) {
print "$k [$q->{$k}]\n";
}
print "\nEnvironment Variables:\n=================\n";
foreach my $k ( sort keys %ENV ) {
print "$k [$ENV{$k}]\n";
}
and save this file
change the filemod
nas_zolder:/c/backuppc_share/apache2/cgi-bin# chmod o+x my_test
start apache:
nas_zolder:/c/backuppc_share/apache2/conf# /c/backuppc_share/apache2/bin/apachectl start
check if the server is running by surfing to http://192.168.3.101:8080/
-> you should get an 'It Works' page
stop apache:
nas_zolder:/c/backuppc_share/apache2/conf# /c/backuppc_share/apache2/bin/apachectl stop-> 'It Works' page should not work anymore
check if the server is working with mod_perl
start apache:
nas_zolder:/c/backuppc_share/apache2/conf# /c/backuppc_share/apache2/bin/apachectl startsurf to http://192.168.3.101:8080/cgi-bin/my_test
-> you should get an overview page with quite some info
making Apache start up automatically during booting
(startup script init.d: -> http://julmis.julmajanne.com/index.php/LAMP+on+Debian)
nas_zolder:/c/backuppc_share/apache2/conf# cd /
nas_zolder:/# vi /etc/init.d/apache2_backuppc
copy paste the following
#!/bin/sh
case "$1" in
start)
echo "Starting Apache ..."
# Change the location to your specific location
/c/backuppc_share/apache2/bin/apachectl start
;;
stop)
echo "Stopping Apache ..."
# Change the location to your specific location
/c/backuppc_share/apache2/bin/apachectl stop
;;
graceful)
echo "Restarting Apache gracefully..."
# Change the location to your specific location
/c/backuppc_share/apache2/bin/apachectl graceful
;;
restart)
echo "Restarting Apache ..."
# Change the location to your specific location
/c/backuppc_share/apache2/bin/apachectl restart
;;
*)
echo "Usage: '$0' {start|stop|restart|graceful}"
exit 64
;;
esac
exit 0
nas_zolder:/# cd /etc/init.d
nas_zolder:/etc/init.d# chmod +x ./apache2_backuppc
On top of that you need to add it to the right run level. First we need to find out in which run level we are working
nas_zolder:/etc/init.d# runlevel
this should give N 2
Adding it to this run level at start up:
nas_zolder:/etc/init.d# /usr/sbin/update-rc.d apache2_backuppc start 20 2 3 4 5 6 . stop 80 0 1 .
check if it is working:
stop apache to be sure it is not working already:
nas_zolder:/etc/init.d# /c/backuppc_share/apache2/bin/apachectl stop-> 'It Works' page should not work anymore
nas_zolder:/etc/init.d# ./apache2_backuppc startyou should see 'Starting Apache ...' in the terminal, surf to http://ip_server:8080/ and check that the it works page is working back
nas_zolder:/etc/init.d# ./apache2_backuppc stopsurf to http://ip_server:8080/ and check that it is not serving the 'it works' page
same thing should be possible by
/etc/init.d/apache2_backuppc start
/etc/init.d/apache2_backuppc stop
6. nmblookup
nas_zolder:/etc/init.d# cd /
nas_zolder:/# nmblookup -- help
most probably you will get the answer '-bash: nmblookup: command not found'
for some reason nmblookup isn't part (yet) of the smbclient installation on my machine
installing this program only is not really well documented ;-)
I didn't want to interfere with the present samba setup, so I tried the following:
(the latest version of samba is version 4.x.x and I couldn't get it working easily, so i opted to choose a less recent version)
nas_zolder:/# wget http://ftp.samba.org/pub/samba/samba-3.6.20.tar.gz
nas_zolder:/# tar zxvf samba-3.6.20.tar.gz
nas_zolder:/# cd samba-3.6.20
nas_zolder:/samba-3.6.20# cd source3
nas_zolder:/samba-3.6.20/source3# ./configure
ONLY make !!!!! but this takes a real long time ...
nas_zolder:/samba-3.6.20/source3# make
find the newly created program
nas_zolder:/samba-3.6.20/source3# cd /-> should be /samba-3.6.20/source3/bin/nmblookup
nas_zolder:/# find / -name nmblookup
verify:
nas_zolder:/# cd /samba-3.6.20/source3/bin/-> you should see somewhere nmblookup
nas_zolder:/samba-3.6.20/source3/bin# ls
copy to /usr/bin/ dir:
nas_zolder:/samba-3.6.20/source3/bin# cp ./nmblookup /usr/bin/nmblookup
7. backuppc
nas_zolder:/samba-3.6.20/source3/bin# cd /for some reason it saves the file as download -> rename it
nas_zolder:/# wget http://sourceforge.net/projects/backuppc/files/latest/download
latest status was at time of writing this manual BackupPC-3.3.0.tar
nas_zolder:/# mv ./download ./BackupPC-3.3.0.tar.gz
nas_zolder:/# tar zxf BackupPC-3.3.0.tar.gz
nas_zolder:/# cd BackupPC-3.3.0
nas_zolder:/# /c/backuppc_share/perl/bin/perl configure.pl
first question = new install, so don't fill in a path, just hit return
second question -> ! change perl location during setup !!
--> Are these paths correct? [y]? n
-> perl: /c/backuppc_share/perl/bin/perl
don't forget to change the following config info too:
Install Directory: /c/backuppc_share/prog
data directory: /c/backuppc_share/data
CGI bin Directory: /c/backuppc_share/apache2/cgi-bin
Apache image Directory: /c/backuppc_share/apache2/htdocs/BackupPC
URL for image directory (omit http://host; starts with '/') []? /BackupPC
for the other questions just accept the proposed values
... rest of the installation should go smoothly
after the installation:
make sure that the user backuppc owns /c/backuppc_share/prog/bin
nas_zolder:/BackupPC-3.3.0# cd /c/backuppc_share/prog/bin
nas_zolder:/c/backuppc_share/prog/bin# ls -a -l
if backuppc is not the owner of everything ->
nas_zolder:/c/backuppc_share/prog/bin# chown -R backuppc *
make the BackupPC_Admin script executable
nas_zolder:/c/backuppc_share/prog/bin# cd /c/backuppc_share/apache2/cgi-binyou should see a file BackupPC_Admin
nas_zolder:/c/backuppc_share/apache2/cgi-bin# ls -a -l
make the init.d file work for automatic startup of backuppc during boot cycle:
nas_zolder:/c/backuppc_share/prog/bin# cd /BackupPC-3.3.0/init.d
nas_zolder:/BackupPC-3.3.0/init.d# cp ./debian-backuppc /etc/init.d/backuppc
for me this was however not working, I changed the init.d script for backuppc as followed:
#!/bin/sh
#
# DESCRIPTION
#
# Startup init script for BackupPC on Debian.
#
# Distributed with BackupPC version 3.3.0, released 14 Apr 2013.
#
set -e
#
BINDIR=/c/backuppc_share/prog/bin
DATADIR=/c/backuppc_share/data
LOGDIR=/var/log/BackupPC
USER=backuppc
#
NAME=backuppc
DAEMON=BackupPC
test -x $BINDIR/$DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $NAME: "
/sbin/start-stop-daemon --start --pidfile $LOGDIR/BackupPC.pid -c $USER --exec $BINDIR/$DAEMON -- -d
echo "ok."
;;
stop)
echo -n "Stopping $NAME: "
/sbin/start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER --oknodo --retry 30 -x /c/backuppc_share/perl/bin/perl
echo "ok."
;;
restart)
echo -n "Restarting $NAME: "
/sbin/start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid -u $USER --oknodo --retry 30 -x /c/backuppc_share/perl/bin/perl
/sbin/start-stop-daemon --start --pidfile $LOGDIR/BackupPC.pid -c $USER --exec $BINDIR/$DAEMON -- -d
echo "ok."
;;
reload|force-reload)
echo "Reloading $NAME configuration files"
/sbin/start-stop-daemon --stop --pidfile $LOGDIR/BackupPC.pid --signal 1 -x /c/backuppc_share/perl/bin/perl
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
than to make sure this backuppc init.d scripts starts
nas_zolder:/# cd /etc/init.d
nas_zolder:/etc/init.d# chmod 751 ./backuppc
nas_zolder:/etc/init.d# /usr/sbin/update-rc.d backuppc start 30 2 3 4 5 6 . stop 80 0 1 .
to make temporarly the admin interface available for everyone, later on you change the complete config through the web admininterface
nas_zolder:/BackupPC-3.3.0/init.d# cd /-> around row 2022 (in vi you can jump to line 2022 by typing :2022)
netgear_NV:/# vi /etc/BackupPC/config.pl
$Conf{CgiAdminUsers} = '*';
save with :wq
start up apache if it is not running (check http://192.168.3.101:8080 in my case)
nas_zolder:/# /c/backuppc_share/apache2/bin/apachectl start
start up backuppc
nas_zolder:/# su backuppc
backuppc@nas_zolder:/$ /c/backuppc_share/prog/bin/BackupPC -d
alternative way to start backuppc:
nas_zolder:/# /etc/init.d/backuppc start
check if the program BackupPC is running
nas_zolder:/# /c/backuppc_share/prog/bin/BackupPC_serverMesg status info-> you should get a reply with a few lines of parameters and numbers
to access the admin interface, browse with another computer to:
http://192.168.3.101:8080/cgi-bin/BackupPC_Admin
8. clean up
. perl
nas_zolder:/# cd /
nas_zolder:/# rm -r perl-5.18.1
nas_zolder:/# rm perl-5.18.1.tar.gz
. apache2
nas_zolder:/# rm -r httpd-2.2.26
nas_zolder:/# rm httpd-2.2.26.tar.gz
nas_zolder:/# rm apr-1.5.0.tar.gz
nas_zolder:/# rm apr-util-1.5.3.tar.gz
. mod_perl
nas_zolder:/# rm -r mod_perl-2.0.8
nas_zolder:/# rm mod_perl-2.0.8.tar.gz
. nmblookup
nas_zolder:/# rm -r samba-3.6.20
nas_zolder:/# rm samba-3.6.20.tar.gz
. backuppc
nas_zolder:/# rm -r BackupPC-3.3.0
nas_zolder:/# rm BackupPC-3.3.0.tar.gz
2 Replies
Replies have been turned off for this discussion
- bart_stevensAspirantBy the way ...
I use this backuppc mainly for backing up another ReadyNAS his shares. Not that I had in the past problems with this ReadyNAS his disks, but all disks will fail eventually (from a readynas NV+ 2 of the 4 disks died in the mean time). Furthermore Raid is not a backup strategy, when you change a file and save it ... and you notice that you shouldn't have changed that particular file ... there is no hope without a backup. This backuppc is in my eyes not enough and I have an automatic offsite backup, but that's another story.
configuration for making this work via rsync:
in the readynas that needs to be backed up:
* enable Rsync underneath ‚services’ in the admin interface
* in the share list I have limited the access through rsync to my backuppc host (by entering this ip address) and it is only read access.
in the readyNAS running backuppc -> I’m using the following config to back up the other ReadyNAS
-> XferMethod: rsyncd
-> RsyncShareName: the name of your share without / or \, example: doc_bart
-> I disabled RsyncdAuthRequired
My other use is backing up different users on a mac
I do this with tar over ssh. If there is somebody interested I can write down how this can be done (there will be certainly better and safer methods than the one I use) … but hey it works for me - bart_stevensAspiranthmmm people are viewing this post, but no reactions ... don't think this is a good sign ;-)
anyway ... this is how I backup multiple user accounts on a mac mini with backuppc using tar over ssh.
For sure there will be improvements possible!
Setup: Mac mini ip address 192.168.2.238 with multiple users like admin, bart, …
! before you start, go in your mac his/hers system preferences -> sharing -> activate external logins for all users. otherwise you get ‚ssh: connect to host 192.168.2.238 port 22: Connection refused’ !
on client (macmini in this case)
log in as the user that you want to backup (in this example 'admin'), type in a clean terminal window :
(if the .ssh dir doesn’t exist)
-> Mac-mini-van-admin:~ admin$ mkdir ~/.sshMac-mini-van-admin:~ admin$ cd ~/.ssh
->
Mac-mini-van-admin:~ admin$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/admin/.ssh/id_rsa):
-> hit 3 times enter (= empty passphrase)
->
Your identification has been saved in /Users/admin/.ssh/id_rsa.
Your public key has been saved in /Users/admin/.ssh/id_rsa.pub.
…
to recognize which file belongs to who, I use a combination from the hardware and the user: macmini_admin_id_rsaMac-mini-van-admin:.ssh admin$ cp ./id_rsa.pub ./macmini_admin_id_rsa.pub
on server
open a new terminal window and type:Mac-mini-van-admin:~ admin$ ssh backuppc@192.168.3.101
…
Are you sure you want to continue connecting (yes/no)? yes
…
backuppc@192.168.3.101's password:
-> type the requested passwordbackuppc@nas_zolder:~$ mkdir ~/.ssh
…
backuppc@nas_zolder:~$ cd .ssh
backuppc@nas_zolder:~/.ssh$ ssh-keygen -t rsa
Enter file in which to save the key (/home/backuppc/.ssh/id_rsa):
-> hit 3 times enter (= empty passphrase)
to recognize the pub file belongs to the readynas:Mac-mini-van-admin:.ssh admin$ cp ./id_rsa.pub ./nas_zolder_backuppc_id_rsa.pub
on client
copy the public key from the NAS by means of a secure copy (scp)Mac-mini-van-admin:.ssh admin$ scp backuppc@192.168.3.101://home/backuppc/.ssh/nas_zolder_backuppc_id_rsa.pub .
-> type password
check if copy went okMac-mini-van-admin:.ssh admin$ ls -a -l
-> you should see nas_zolder_backuppc_id_rsa.pub
add the NAS key to the authorized keys:Mac-mini-van-admin:.ssh admin$ cat ./nas_zolder_backuppc_id_rsa.pub >> ~/.ssh/authorized_keys
on server
do the same as on the client, my client has ip address 192.168.2.238, user adminbackuppc@nas_zolder:~/.ssh$ scp admin@192.168.2.238:/Users/admin/.ssh/macmini_admin_id_rsa.pub .
-> password
check if copy went okbackuppc@nas_zolder:~/.ssh$ ls -a -l
-> you should see the file ‚macmini_admin_id_rsa.pub’
add the client with this user login to the known hostsbackuppc@nas_zolder:~/.ssh$ touch known_hosts
backuppc@nas_zolder:~/.ssh$ cat ./macmini_admin_id_rsa.pub >> ~/.ssh/known_hosts
check if it ssh working:backuppc@nas_zolder:~/.ssh$ ssh -l admin 192.168.2.238 whoami
goal is that you don’t have to type a password and that you immediately see your login name ‚admin’ in this case.
if you need to type your password, try verbose logging with the -v optionbackuppc@nas_zolder:~/.ssh$ ssh -v -l admin 192.168.2.238 whoami
If you need to add additional users on the same computer a shorter version is applicable:
on client
login as that user (or by means of su)bash-3.2$ cd ~/.ssh
if this dir is not existing: mkdir ~/.ssh and than cd ~/.sshbash-3.2$ ssh-keygen -t rsa
-> hit 3 times enter (= empty passphrase)
to recognize which file belongs to whobash-3.2$ cp ./id_rsa.pub ./macmini_bart_id_rsa.pub
copy the public key from the NAS by means of a secure copy (scp)bash-3.2$ scp backuppc@192.168.3.101://home/backuppc/.ssh/nas_zolder_backuppc_id_rsa.pub .
-> type password and say that you want to connect.bash-3.2$ cat ./nas_zolder_backuppc_id_rsa.pub >> ~/.ssh/authorized_keys
on server
in the next path the user admin should be replaced on 3 spots!!backuppc@nas_zolder:~/.ssh$ scp bart@192.168.2.238:/Users/bart/.ssh/macmini_bart_id_rsa.pub .
-> file should come overbackuppc@nas_zolder:~/.ssh$ cat ./macmini_bart_id_rsa.pub >> ~/.ssh/known_hosts
check:backuppc@nas_zolder:~/.ssh$ ssh -l bart 192.168.2.238 whoami
should give you ‚bart’
If this is done, the hard part is over. The only thing that’s left is the configuration of the client in the backuppc admin interface (of config file)
-> configuring backuppc for mac clients copying over tar:
Xfermethod = tar
Tarsharename = -> insert the tar share: / (just the basic root slash)
BackupFilesOnly
-> add a new key: /
-> insert the path: /Users/admin
in the same way you can exclude directories with BackupFilesExclude: Key is the tar share = / -> Insert the did you want to exclude like ‚/Users/admin/Library/Caches/Metadata/Safari/History/‚
tarclientpath: /usr/bin/tar
tarclientcmd: $sshPath -q -x -l admin $host $tarPath -c -v -f - -C $shareName+ --totals
-> I used the user his name explicitly in the tarclientcmd ...
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!