[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] OT- BackupPC excludes not working



Dear Sir,

-------------------- SNIP ---------------------------

Can someone suggest the proper syntax for getting excludes to work on my
BackupPC installation?  I want to exclude a certain folder from a user's
home directory.  Home is on a separate partition so it has it's own
entry in the BackupPC conf under share names.

I have this under rsync args:

'--one-file-system',
'--exclude=/var/spool/squid',
'--exclude=slocated.db',
'--exclude=/proc', '--exclude=/home/ckeil/secret',
'--exclude=/home/www/k12ltsp'


and this under conf(backupfilesexclude) :
'/proc', '/var/spool/squid','slocate.db', '/home/ckeil/secret/*', '/home/www/k12ltsp/*';
why isn't this working. I just noticed that I have the /* in one place
and not in the other, but I've tried it both ways in both places. A
related question, how will I know this is working? I'm assuming that
after the next incremental backup after I get this right then those
directories won't appear in the backups. Is there a way to delete
backed up information from the backup server?


-------------------- SNIP ---------------------------

here is my document, "http://fedoranews.org/contributors/";
am sending as attachement for your kind reference in case it is not accessible.


regards,

Bimal


NETWORK BACKUP MADE SIMPLE – BACKUPPC


This document will help you to install BackupPC on your system in a HETROGENEOUS ENVIRONMENT(LIN/WIN), using RSYNC ONLY and it is my suggestion that one should go through this document first, before to start installing and also please refer to the "BackupPC.html" file/document which came with this package(BackupPC-2.1.0.tar.gz, located at /opt/backuppc/doc/BackupPC.html -- after following below given steps) and is a complete reference OR should visit BackupPC's homepage.

Use your "root" privileges to install all these, until and unless specified

As of here, i am taking an example as
- O/S RedHat 9.
- will be using rsync as my transport method.
- all my systems has static IP address scheme.

NOTE:- exactly same installation procedure for FedoraCore3

1)Server
Name:- bkupsvr
IP:- 192.168.0.26
RAM:- 512MB
Processor:- PIV
HDD:-
     hda - O/s - RH9, 40GB
     hdb - CDROM
     hdc - 200GB
     hdd – 200GB

here i have done software raid1(hdc & hdd) and mounted my "data"  directory on it,
which will store all the backups(RAID is not covered here).

2)Clients
Name:- node003
IP:- 192.168.0.3
HDD:- hda - O/s - RH9, 40GB
     
Name:- node034
IP:- 192.168.0.34
HDD:- hda - O/s - win2k, 40GB

Name:- node017
IP:- 192.168.0.17
HDD:- hda - O/s - FedoraCore3, 40GB

Name:- node031
IP:- 192.168.0.31
HDD:- hda - O/s - win98, 40GB

STARTING

one may need to install some packages as per their O/s installed and requirement, though all the packages are not mandatory, you can go ahead without some of these, but having all is no harm, here goes the list...

bzip2,cat,df,gtar/tar,gzip,hostname,nmblookup,par2,perl,ping,rsync,sendmail,smbclient,split,ssh/ssh2

NOTE:- I am taking /home/bimal as my reference point as i kept all my packages here!!

adding user "backuppc"

[bimal bkupsvr bimal]# useradd backuppc

[bimal bkupsvr bimal]# passwd backuppc
<enter your passwd>

on my system, i didn't found some packages so i installed them as,

[bimal bkupsvr bimal]# rpm -ivh perl-Compres-Zlib-1.16-11.i386

[bimal bkupsvr bimal]# rpm -ivh perl-Archive-Zip-1.05-1.i686

in /usr/local directory i did

[bimal bkupsvr bimal]# cd /usr/local

[bimal bkupsvr local]# tar -xvzf /home/bimal/par2cmdline-0.4.tar.gz

[bimal bkupsvr local]# cd par2cmdline-0.4

[bimal bkupsvr par2cmdline-0.4]# ./configure

[bimal bkupsvr par2cmdline-0.4]# make

[bimal bkupsvr par2cmdline-0.4]# make install

[bimal bkupsvr par2cmdline-0.4]# cd /usr/local

[bimal bkupsvr local]# tar -xvzf /home/bimal/File-RsyncP-0.52.tar.gz

[bimal bkupsvr local]# cd File-RsyncP-0.52

[bimal bkupsvr File-RsyncP-0.52]# perl Makefile.PL

now installing BackupPC

[bimal bkupsvr File-RsyncP-0.52]# cd /usr/local

[bimal bkupsvr local]# tar -xvzf /home/bimal/BackupPC-2.1.0.tar.gz

[bimal bkupsvr local]# cd BackupPC-2.1.0

[bimal bkupsvr BackupPC-2.1.0]# patch -p0  < BackupPC-2.1.0pl1.diff

NOTE:- ONE SHOULD SPECIFY THE PLACE OF PATCH FILE,AND NEED NOT TO CREATE ANY DIRECTORY....   THE SCRIPT THAT YOU WILL RUN WILL DO ALL THESE FOR "U".

now proceed as per the messages you are getting, here is mine:-

[bimal bkupsvr BackupPC-2.1.0]# perl configure.pl
                                                                                                                            
Is this a new installation or upgrade for BackupPC?  If this is
an upgrade please tell me the full path of the existing BackupPC
configuration file (eg: /xxxx/conf/config.pl).  Otherwise, just
hit return.
                                                                                                                             
--> Full path to existing conf/config.pl []? -- ENTER --
                                                                                                                             
I found the following locations for these programs:
                                                                                                                             
    bzip2        => /usr/bin/bzip2
    cat          => /bin/cat
    df           => /bin/df
    gtar/tar     => /bin/gtar
    gzip         => /bin/gzip
    hostname     => /bin/hostname
    nmblookup    => /usr/bin/nmblookup
    par2         => /usr/local/bin/par2
    perl         => /usr/bin/perl
    ping         => /bin/ping
    rsync        => /usr/bin/rsync
    sendmail     => /usr/sbin/sendmail
    smbclient    => /usr/bin/smbclient
    split        => /usr/bin/split
    ssh/ssh2     => /usr/bin/ssh
                                                                                                                             
--> Are these paths correct? [y]? y
                                                                                                                             
Please tell me the hostname of the machine that BackupPC will run on.
                                                                                                                             
--> BackupPC will run on host [bkupsvr]? bkupsvr
                                                                                                                             
BackupPC should run as a dedicated user with limited privileges.  You
need to create a user.  This user will need read/write permission on
the main data directory and read/execute permission on the install
directory (these directories will be setup shortly).
                                                                                                                             
The primary group for this user should also be chosen carefully.
By default the install directories will have group write permission.
The data directories and files will have group read permission but
no other permission.
 
--> BackupPC should run as user [backuppc]? backuppc
Please specify an install directory for BackupPC.  This is where the
BackupPC scripts, library and documentation will be installed.
 
--> Install directory (full path) []? /opt/backuppc
 
Please specify a data directory for BackupPC.  This is where the
configuration files, LOG files and all the PC backups are stored.
This file system needs to be big enough to accommodate all the
PCs you expect to backup (eg: at least 1-2GB per machine).
 
--> Data directory (full path) []? /data/backuppc
 
BackupPC can compress pool files, providing around a 40% reduction in pool
size (your mileage may vary). Specify the compression level (0 turns
off compression, and 1 to 9 represent good/fastest to best/slowest).
The recommended values are 0 (off) or 3 (reasonable compression and speed).
Increasing the compression level to 5 will use around 20% more cpu time
and give perhaps 2-3% more compression.
 
--> Compression level [3]? 3

BackupPC has a powerful CGI perl interface that runs under Apache.
A single executable needs to be installed in a cgi-bin directory.
This executable needs to run as set-uid backuppc, or
it can be run under mod_perl with Apache running as user backuppc.
 
Leave this path empty if you don't want to install the CGI interface.
 
--> CGI bin directory (full path) []? /var/www/cgi-bin/backuppc
 
BackupPC's CGI script needs to display various GIF images that
should be stored where Apache can serve them.  They should be
placed somewher under Apache's DocumentRoot.  BackupPC also
needs to know the URL to access these images.  Example:
 
    Apache image directory:  /usr/local/apache/htdocs/BackupPC
    URL for image directory: /BackupPC
 
The URL for the image directory should start with a slash.
 
--> Apache image directory (full path) []? /var/www/html/backuppc
--> URL for image directory (omit http://host; starts with '/') []? /backuppc
 
Ok, we're about to:
 
  - install the binaries, lib and docs in /opt/backuppc,
  - create the data directory /data/backuppc,
  - create/update the config.pl file /data/backuppc/conf,
  - optionally install the cgi-bin interface.
 --> Do you want to continue? [y]?
Created /opt/backuppc/bin
Created /opt/backuppc/doc
Created /opt/backuppc/lib/BackupPC/CGI
Created /opt/backuppc/lib/BackupPC/Lang
Created /opt/backuppc/lib/BackupPC/Xfer
Created /opt/backuppc/lib/BackupPC/Zip
Created /var/www/html/backuppc
Created /data/backuppc/.
Created /data/backuppc/conf
Created /data/backuppc/pool
Created /data/backuppc/cpool
Created /data/backuppc/pc
Created /data/backuppc/trash
Created /data/backuppc/log
Installing binaries in /opt/backuppc/bin
Installing library in /opt/backuppc/lib
Installing images in /var/www/html/backuppc
Making init.d scripts
Installing docs in /opt/backuppc/doc
Installing config.pl and hosts in /data/backuppc/conf
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.063 ms
 
--- localhost.localdomain ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.063/0.063/0.063/0.000 ms
Installing cgi script BackupPC_Admin in /var/www/cgi-bin/backuppc
 
Ok, it looks like we are finished.  There are several more things you
will need to do:
 
  - Browse through the config file, /data/backuppc/conf/config.pl,
    and make sure all the settings are correct.  In particular, you
    will need to set the smb share password and user name, backup
    policies and check the email message headers and bodies.
 
  - Edit the list of hosts to backup in /data/backuppc/conf/hosts.
 
  - Read the documentation in /opt/backuppc/doc/BackupPC.html.
    Please pay special attention to the security section.
 
  - Verify that the CGI script BackupPC_Admin runs correctly.  You might
    need to change the permissions or group ownership of BackupPC_Admin.
 
  - BackupPC should be ready to start.  Don't forget to run it
    as user backuppc!  The installation also contains an
    init.d/backuppc script that can be copied to /etc/init.d
    so that BackupPC can auto-start on boot.  This will also enable
    administrative users to start the server from the CGI interface.
    See init.d/README.
 
Enjoy!

NOTE:- values in [] are in fact default values, if you didn't enter anything it will be taken while blank one needs value to proceed.

now we should proceed  to configure apache server for backuppc's CGI interface use, here i will be using Mod_perl Setup,so make sure that your apache has this while, in my case, i had rpm package installed mod_perl-1.99_07-5.i386

so open apache conf file and make changes as:-

[bimal bkupsvr bimal]# vi /etc/httpd/conf/httpd.conf

user backuppc
group backuppc

ServerName 192.168.0.26 "OR ServerName bkupsvr (if name is resolvable)"

<Directory /var/www/cgi-bin/backuppc>
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
        Order deny,allow
        Deny from all
        Allow from 192.168.0
        AllowOverride Indexes AuthConfig  
        AuthName "Backup Admin"
        AuthType Basic
        AuthUserFile /var/www/cgi-bin/.backuppcpsswd
        Require valid-user
</Directory>

save and exit, this file.

now create this file and set a password for the admin as

[bimal bkupsvr bimal]# htpasswd -c /var/www/cgi-bin/.backuppcpsswd    admin
New password:
Re-type new password:
Updating password for user admin

NOTE:- please check the permission on this file, should have read for all, if not then give it as

[bimal bkupsvr bimal]# chmod 644 /var/www/cgi-bin/.backuppcpsswd

now change the permission of BackupPC_Admin as(since using mod_perl)

[bimal bkupsvr bimal]# chmod u-s /var/www/cgi-bin/backuppc/BackupPC_Admin

[bimal bkupsvr bimal]# cp  /usr/local/BackupPC-2.1.0/init.d/src/linux-backuppc     
 /etc/rc.d/init.d/backuppc

now for auto start, add it through chkconfig as

[bimal bkupsvr bimal]# chkconfig --add backuppc

[bimal bkupsvr bimal]# chkconfig --level 345 backuppc on

			SO THE INSTALLATION IS COMPLETE !!

NOW I WILL PROCEED TO CONFIGURE BackupPC for rsync, so here are my configs:-

config.pl(This is the main FILE)

[bimal bkupsvr bimal]# vi /data/backuppc/conf/config.pl

$Conf{ServerHost} = 'bkupsvr';
$Conf{ServerPort} = -1;
$Conf{ServerMesgSecret} = '';
$Conf{MyPath} = '/bin';
$Conf{UmaskMode} = 027;
$Conf{WakeupSchedule} = [1..23];
$Conf{MaxBackups} = 4;
$Conf{MaxUserBackups} = 4;
$Conf{MaxPendingCmds} = 10;
$Conf{MaxBackupPCNightlyJobs} = 2;
$Conf{BackupPCNightlyPeriod} = 1;
$Conf{MaxOldLogFiles} = 14;
$Conf{DfPath} = '/bin/df';
$Conf{DfCmd} = '$dfPath $topDir';
$Conf{SplitPath} = '/usr/bin/split';
$Conf{ParPath}   = '/usr/local/bin/par2';
$Conf{CatPath}   = '/bin/cat';
$Conf{GzipPath}  = '/bin/gzip';
$Conf{Bzip2Path} = '/usr/bin/bzip2';
$Conf{DfMaxUsagePct} = 95;
$Conf{TrashCleanSleepSec} = 300;
$Conf{DHCPAddressRanges} = [];
$Conf{BackupPCUser} = 'backuppc';
$Conf{CgiDir}       = '/var/www/cgi-bin/backuppc';
$Conf{InstallDir}   = '/opt/backuppc';
$Conf{BackupPCUserVerify} = 1;
$Conf{HardLinkMax} = 31999;
$Conf{TarShareName} = '/';
$Conf{FullPeriod} = 6.97;
$Conf{IncrPeriod} = 0.97;
$Conf{FullKeepCnt} = 4;
$Conf{FullKeepCntMin} = 1;
$Conf{FullAgeMax}     = 90;
$Conf{IncrKeepCnt} = 6;
$Conf{IncrKeepCntMin} = 1;
$Conf{IncrAgeMax}     = 30;
$Conf{PartialAgeMax} = 3;
$Conf{IncrFill} = 0;
$Conf{RestoreInfoKeepCnt} = 10;
$Conf{ArchiveInfoKeepCnt} = 10;
$Conf{BackupFilesOnly} = [ '/home' ];
$Conf{BackupFilesExclude} = undef; 
$Conf{BlackoutBadPingLimit} = 3;
$Conf{BlackoutGoodCnt}      = 7;
$Conf{BlackoutPeriods} = [
    {
	    hourBegin => 23.8,
	    hourEnd   => 23.9,
	    weekDays  => [0, 1, 2, 3, 4, 5, 6],
	},
];
$Conf{BackupZeroFilesIsFatal} = 0;
$Conf{XferMethod} = 'rsync';
$Conf{XferLogLevel} = 3;
$Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host'
                    . ' $tarPath -c -v -f - -C $shareName+'
                    . ' --totals';
$Conf{TarFullArgs} = '$fileList+';
$Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+';
$Conf{TarClientRestoreCmd} = '$sshPath -q -x -l root $host'
		   . ' $tarPath -x -p --numeric-owner --same-owner'
		   . ' -v -f - -C $shareName+';
$Conf{TarClientPath} = '/bin/tar';
$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';
$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';
$Conf{RsyncShareName} = '/';
$Conf{RsyncdClientPort} = 873;
$Conf{RsyncdUserName} = '';
$Conf{RsyncdPasswd} = '';
$Conf{RsyncdAuthRequired} = 1;
$Conf{RsyncCsumCacheVerifyProb} = 0.01;
$Conf{RsyncArgs} = [
            '--numeric-ids',
            '--perms',
            '--owner',
            '--group',
            '--devices',
            '--links',
            '--times',
            '--block-size=2048',
            '--recursive',
	    '--exclude', 'boot',
	    '--exclude', 'dev',
	    '--exclude', 'lib',
	    '--exclude', 'misc',
	    '--exclude', 'opt',
	    '--exclude', 'proc',
	    '--exclude', 'sbin',
	    '--exclude', 'tmp',
	    '--exclude', 'var',
	    '--exclude', 'bin',
	    '--exclude', 'etc',
	    '--exclude', 'initrd',
	    '--exclude', 'lost+found',
	    '--exclude', 'mnt',
	    '--exclude', 'tftpboot',
	    '--exclude', 'usr',
];
$Conf{RsyncRestoreArgs} = [
	    '--numeric-ids',
	    '--perms',
	    '--owner',
	    '--group',
	    '--devices',
	    '--links',
	    '--times',
	    '--block-size=2048',
	    '--relative',
	    '--ignore-times',
	    '--recursive',
	    '--one-file-system',
];
$Conf{ArchiveDest} = '/tmp';
$Conf{ArchiveComp} = 'gzip';
$Conf{ArchivePar} = 0;
$Conf{ArchiveSplit} = 0;
$Conf{ArchiveClientCmd} = '$Installdir/bin/BackupPC_archiveHost'
	. ' $tarCreatePath $splitpath $parpath $host $backupnumber'
	. ' $compression $compext $splitsize $archiveloc $parfile *';
$Conf{SshPath} = '/usr/bin/ssh';
$Conf{NmbLookupPath} = '/usr/bin/nmblookup';
$Conf{NmbLookupCmd} = '$nmbLookupPath -A $host';
$Conf{NmbLookupFindHostCmd} = '$nmbLookupPath $host';
$Conf{FixedIPNetBiosNameCheck} = 0;
$Conf{PingPath} = '/bin/ping';
$Conf{PingCmd} = '$pingPath -c 1 -w 3 $host';
$Conf{ServerInitdPath} = '/etc/init.d/backuppc';
$Conf{ServerInitdStartCmd} = '';'$sshPath -q -x -l root $serverHost'
                            . ' $serverInitdPath start'
                            . ' < /dev/null >& /dev/null';
$Conf{CompressLevel} = 3;
$Conf{PingMaxMsec} = 50;
$Conf{ClientTimeout} = 7200;
$Conf{MaxOldPerPCLogFiles} = 12;
$Conf{DumpPreUserCmd}     = undef;
$Conf{DumpPostUserCmd}    = undef;
$Conf{RestorePreUserCmd}  = undef;
$Conf{RestorePostUserCmd} = undef;
$Conf{ArchivePreUserCmd}  = undef;
$Conf{ArchivePostUserCmd} = undef;
$Conf{ClientNameAlias} = undef;
$Conf{PerlModuleLoad}     = undef;
$Conf{SendmailPath} = '/usr/sbin/sendmail';
$Conf{EMailNotifyMinDays} = 2.5;
$Conf{EMailFromUserName} = 'backuppc';
$Conf{EMailAdminUserName} = 'bimal pandit bimalpandit com';
$Conf{EMailUserDestDomain} = 'bimal pandit bimalpandit com';
$Conf{EMailNoBackupEverSubj} = undef;
$Conf{EMailNoBackupEverMesg} = undef;
$Conf{EMailNotifyOldBackupDays} = 7.0;
$Conf{EMailNoBackupRecentSubj} = undef;
$Conf{EMailNoBackupRecentMesg} = undef;
$Conf{EMailNotifyOldOutlookDays} = 5.0;
$Conf{EMailOutlookBackupSubj} = undef;
$Conf{EMailOutlookBackupMesg} = undef;
$Conf{CgiAdminUserGroup} = 'admin';
$Conf{CgiAdminUsers}     = 'admin';
$Conf{CgiURL} = 'http://bkupsvr/cgi-bin/backuppc/BackupPC_Admin';
$Conf{Language} = 'en';
$Conf{CgiUserHomePageCheck} = '';
$Conf{CgiUserUrlCreate}     = 'mailto:%s';
$Conf{CgiDateFormatMMDD} = 0;
$Conf{CgiNavBarAdminAllHosts} = 1;
$Conf{CgiSearchBoxEnable} = 1;
$Conf{CgiNavBarLinks} = [
    {
        link  => "?action=view&type=docs",
        lname => "Documentation",    # actually displays $Lang->{Documentation}
    },
    {
        link  => "http://internal1.bimalpandit.com";,
        name  => "FAQ",              # displays literal "FAQ"
    },
    {
        link  => "http://internal1.bimalpandit.com";,
        name  => "SourceForge",      # displays literal "SourceForge"
    },
];
$Conf{CgiStatusHilightColor} = {
    Reason_backup_failed           => '#ffcccc',
    Reason_backup_done             => '#ccffcc',
    Reason_no_ping                 => '#ffff99',
    Reason_backup_canceled_by_user => '#ff9900',
    Status_backup_in_progress      => '#66cc99',
};
$Conf{CgiHeaders} = '<meta http-equiv="pragma" content="no-cache">';
$Conf{CgiImageDir} = '/var/www/html/backuppc';
$Conf{CgiExt2ContentType} = { };
$Conf{CgiImageDirURL} = '/backuppc';
$Conf{CgiCSSFile} = 'BackupPC_stnd.css';

hosts

[bimal bkupsvr bimal]# vi /data/backuppc/conf/hosts

host            dhcp    user    	moreUsers   	 
192.168.0.3 	0       root    	admin,backuppc    
192.168.0.17  	0       root    	admin,backuppc
192.168.0.31  	0       root    	admin,backuppc
192.168.0.34  	0       root    	admin,backuppc 

per node config.pl file

it may be required to take a backup of some other directory or directory structure as per the node/client in that case we need to create config file for those nodes as i did...

[bimal bkupsvr bimal]# vi /data/backuppc/pc/192.168.0.17/config.pl

$Conf{XferMethod} = 'rsync';

$Conf{XferLogLevel} = 3;

$Conf{RsyncClientPath} = '/usr/bin/rsync';

$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';

$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';

$Conf{BackupFilesOnly} = [ '/data' ];


[bimal bkupsvr bimal]# vi /data/backuppc/pc/192.168.0.3/config.pl

$Conf{XferMethod} = 'rsync';

$Conf{XferLogLevel} = 3;

$Conf{RsyncClientPath} = '/usr/bin/rsync';

$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';

$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';

$Conf{BackupFilesOnly} = [ '/home' ];


			NOW AUTOMATING SSH FOR CLIENTS(LIN/WIN)


now making an automated(without asking password) process for SSH

on bkupsvr do as 

[bimal bkupsvr bimal]# su - backuppc

and you will get backuppc user's prompt, now do

[backuppc bkupsvr backuppc]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/backuppc/.ssh/id_rsa):
Created directory '/home/backuppc/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/backuppc/.ssh/id_rsa.
Your public key has been saved in /home/backuppc/.ssh/id_rsa.pub.
The key fingerprint is:
b8:30:b9:b3:53:4c:29:80:0e:fe:5f:c0:58:5c:6e:df backuppc bkupsvr

now you need to put "id_rsa.pub" file(in fact, content) into clients "/root/.ssh/"
directory as(here i am using /root/.ssh/ as i will be taking backup of root privileged directory e.g. /home OR else you may need to adjust as per your requirement)

[backuppc bkupsvr backuppc]$ 

for node003

[backuppc bkupsvr backuppc]$ scp /home/backuppc/.ssh/id_rsa.pub 
 root 192 168 0 3:/root/.ssh/backuppc_pub_key (you need to provide root password as of now)

for node017

[backuppc bkupsvr backuppc]$scp /home/backuppc/.ssh/id_rsa.pub 
 root 192 168 0 17:/root/.ssh/backuppc_pub_key (you need to provide root password as of now)

now on both the nodes do

[root node003 root]# cd /root/.ssh/

[root node003 .ssh]# cat backuppc_pub_key >> authorized_keys2

now check whether this is working or not so, on server bkupsvr

[bimal bkupsvr bimal]# su - backuppc

[backuppc bkupsvr backuppc]$ ssh -l root 192.168.0.3 whoami 

			OR

[backuppc bkupsvr backuppc]$ ssh -l root node003 whoami(if name is resolvable)

this should return root, if not that means that your ssh automated part is having some error!! recheck it, similarly do and check for node017

The above was done for linux nodes while for windows side, what i did is a bit indirect method but i couldn't found better than this(may be i missed something or is due to the lack of my knowledge!! -- NO SAMBA!!)

i created two directories on node017 machine as

[root node017 root]# mkdir /data

[root node017 root]# cd /data

[root node017 data]# mkdir  node031  node034  

and given rights to user bimal on node031 and balwant on node034

i downloaded rsync_full.zip from http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html
and extracted  it in "c" drive, it created "rsync" folder there. Also i followed the above mentioned document for this purpose.

now i had cygwin,ssh,scp etc utilities on these two windows machine(node031 & node034) which will help me to send my data(using rsync) for backup on node017 in their respective directory and then will take backup of "/data" directory with BackupPC.

going into windows command prompt 

c:\rsync>

it contains the following files

chmod, chown, cygcrypto-0.9.7.dll, cygiconv-2.dll, cygminires.dll, cygwin1.dll, cygz.dll, drivec, gnudate, mkgroup, mkpasswd.c, mkpasswd, rsetup, rsync246, scp, sftp, ssh, ssh-add, ssh-agent, ssh-keygen, ssh-keyscan

then i  edited files as(in a notepad/wordpad editor), here am taking an example for win2k machine for user bimal similarly do for user balwant for his directory.

drivec

@echo off
set PATH=c:\rsync;%PATH%
set CYGWIN=tty binmode
set TERM=ansi
rem set RSYNC_RSH=c:\rsync\ssh.exe
set RSYNC_RSH=/cygdrive/c/rsync/ssh.exe
set USERNAME=bimal
set HOME=c:\rsync
echo Drive C >>c:\rsync\rsync.log
c:\rsync\gnudate >>c:\rsync\rsync.log
c:\rsync\rsync246 -e ssh -auvzbP /cygdrive/c/data bimal 192 168 2 17:/data/node031


rsetup

@echo off
echo Try rsync246 -auvzbP file remote:/home/myusername
set PATH=c:\rsync;%PATH%
set CYGWIN=binmode tty
set TERM=ansi
set USERNAME=bimal
set HOME=c:\rsync
set RSYNC_RSH=ssh.exe

now i edited "autoexec.bat" for environment variables and added the following values as :-

autoexec.bat

set PATH=c:\rsync;%PATH%
set CYGWIN=binmode tty
set TERM=ansi
set USERNAME=bimal
set HOME=c:\rsync
set RSYNC_RSH=ssh.exe

now execute this batch file so that it will provide environment variables, to check what variables are available do,

c:\>set
 
also it would be better to reboot the system so that it will be available throughout the system as i found that in case of just execution from here the variables are available here only!!!

now execute rsync related batch files as 

cd  c:\rsync>rsetup

now generate ssh key as 

c:\rsync> ssh-keygen  -t  rsa

this will generate and store the keys in /cygdir/c/rsync/.ssh/   directory as
(if it does not or gives an error then reexecute autoexec.bat, rsetup from c:\rsync>  place and then generate keys from here only)

id_rsa  and  id_rsa.pub

now copy this public key onto the machine to which i want auto login here node017 in /home/bimal/.ssh/  directory, then i did

[bimal node031 bimal]$ cd .ssh

[bimal node031 .ssh]$ cat id_rsa.pub > authorized_keys

(please check the permission, or better do chmod 644 or 400 to authorized_keys, you may need to do again cat id_rsa > authorized_keys , but again check the permissions. Also you can delete the  id_rsa.pub file after this. one may need to generate authorized_keys2 file instaed of authorized_keys as per the version of ssh)

now try doing rsync/ssh from windows m/c to linux box, it should not ask you any password!!!

now i created a batch file as bimal_bkup.bat on windows machine and added 

rsync246 -e ssh -auvzbP /cygdrive/d             bimal 192 168 2 17:/data/node031

here backup backup of  "d" drive is being taken to node017 in /data/node031 directory i.e. you will see /data/node031/d.

a few examples(at windows command prompt)

1) rsync246 -e ssh -auvzbP /cygdrive/c/data        bimal 192 168 2 17:/data/node031
here backup backup of a folder "data" in "c" drive is being taken


2) rsync246 -e ssh -auvzbP /cygdrive/d             bimal 192 168 2 17:/data/node031
here backup backup of  "d" drive is being taken

3)rsync246 -e ssh -auvzbP /cygdrive/f/backup/new   bimal 192 168 2 17:/data/node031
here backup backup of a folder "new" in "backup" folder of "f" drive is being taken

since i could not depend or persue every user everyday to run the command manually, so i made a batch file and used cron like utility in windows(Schedule Tasks) on users windows machine.

for win2k - start --> settings --> control panel --> schedule tasks

for win98 - on desktop - My Computer --> schedule tasks

STARTING AND ACCESSING BACKUPPC

To access, do as...   on server bkupsvr

[bimal bkupsvr bimal]# service httpd start

[bimal bkupsvr bimal]# service backuppc start 

and now point your browser to  http://192.168.0.26/cgi-bin/backuppc/BackupPC_Admin  OR 

http://bkupsvr/cgi-bin/backuppc/BackupPC_Admin

this will ask you for your username and password, enter and will give you a GUI Interface to manage everything!!

EXTREMELY USEFULL LINKS

An excellent article by Ken Gregoire <ken at gordiandata dot net> on BackupPC
http://www.mybizguard.com/modules/wfsection/index.php

A very helpful site for RSYNC on windows
http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html

and ofcourse BackupPC's own site
http://backuppc.sourceforge.net/faq/BackupPC.html

NOTE:-

*) I have installed my backup server(production - live) following the same steps and had tried to put all the information at the maximum so that anyone can install it and take backup in its network system, but you may need to adjust/tune some of the entries.

*) Also in case if you think i committed some mistake or skipped something, its my request to all of you to please bring it into my notice so that no one commits the same!!

*) I have personally tested all these on RedHat 9 as well as on FedoraCore 3 while, one should check the version of packages to be installed accordingly.

*) One can manually start/stop full/incremental backup!! using web interface. Also i have not covered doing all these  stuff using command line options(which is also possible) as i don't have that much information on it, though all the commands are in "/opt/backuppc/bin/" which are actually being used through web interface(one can always see log files for info.)

*) where ever you are using name for a machine, those names must be resolvable or else use IP address(s)

at last,i hope this document will help a few, save some valuable time and ofcourse help me to improve my understanding,skills and knowledge.

Bimal Pandit
bimal pandit indoasian com/hello_bee rediffmail com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]