Installazione e Configurazione di BackupPc

From RVM Wiki
Revision as of 08:24, 30 September 2014 by Gabriele.vivinetto (talk | contribs) (Wheezy update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installazione

  • Installare pacchetti
sudo apt-get install backuppc rsync libfile-rsyncp-perl par2 apache2 postfix
  • Cambiare la password di default per l'accesso a backuppc:
sudo htpasswd /etc/backuppc/htpasswd backuppc
  • Lanciare un backup di localhost dall'interfaccia

Configurazione BackuPC

Cambiare i seguenti parametri:

sudoedit /etc/backuppc/config.pl
$Conf{Language} = 'it';

Configurazione del backup di un host via ssh

Inserire il nome del pc da backuppare:

echo myclient   1       backuppc | sudo tee -a /etc/backuppc/hosts > /dev/null

Creare il file di configurazione scegliendo cosa backuppare:

cat | sudo tee /etc/backuppc/myclient.pl < /dev/null <<'EOFile'
#
# Rsync over ssh Backup
#
# Minimum period in days between full and incremental backups:
# 1 Full alla settimana
$Conf{FullPeriod} = 6.97;
# 2 o almeno un incr al giorno
$Conf{IncrPeriod} = 0.49;

# Number of full and incremental backups to keep:
$Conf{FullKeepCnt} = 5;
$Conf{IncrKeepCnt} = 32;
# Note that additional fulls will be kept for as long as is necessary
# to support remaining incrementals.

# What transport to use backup the client [smb|rsync|rsyncd|tar|archive]:
$Conf{XferMethod} = 'rsync';

# The file system path or the name of the rsyncd module to backup when
# using rsync/rsyncd:
$Conf{RsyncShareName} = '/';

# If this is defined only these files/paths will be included in the backup:
#$Conf{BackupFilesOnly} = undef;

# These files/paths will be excluded from the backup:
$Conf{BackupFilesExclude} = ['/proc',
                       '/dev',
                       '/cdrom',
                       '/floppy',
                       '/mnt',
                       '/var/lib/backuppc',
                       '/lost+found',
                       '/var/spool/squid',
                       '/var/spool/squid3',
                       '/sys'];

# Level of verbosity in Xfer log files:
$Conf{XferLogLevel} = 1;

# Commands to run for client backups:
# Note the use of SSH's -C attribute. This enables compression in SSH.
#$Conf{RsyncClientCmd} = '$sshPath -C -x -l administrator -o PreferredAuthentications=publickey $host $rsyncPath $argList+';

# Commands to run for client direct restores:
# Note the use of SSH's -C attribute. This enables compression in SSH.
#$Conf{RsyncClientRestoreCmd} = '$sshPath -C -q -x -l administrator $host $rsyncPath $argList+';

# Compression level to use on files. 0 means no compression. See notes
# in main config file before changing after backups have already been done.
$Conf{CompressLevel} = 9;

# The backup may occur over vpn. Avoid "ping too slow" errors.
$Conf{PingMaxMsec} = 150;

# Timeout if backing up large files ?
$Conf{ClientTimeout} = 3600*8;      # 6 Hours!!
EOFile


sudo chown backuppc:www-data /etc/backuppc/myclient.pl
sudo chmod o= /etc/backuppc/myclient.pl
  • Riavviare backuppc
sudo /etc/init.d/backuppc restart
  • Controllare via web che l'host sia presente

Configurazione dell'accesso ssh sulla macchina da backuppare

  • Creare la chiave privata di backuppc sul server backuppc
sudo -i -u backuppc ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa): <-- <ENTER>
Created directory '/var/lib/backuppc/.ssh'.
Enter passphrase (empty for no passphrase): <-- <ENTER>
Enter same passphrase again: <-- <ENTER>
Your identification has been saved in /var/lib/backuppc/.ssh/id_rsa.
Your public key has been saved in /var/lib/backuppc/.ssh/id_rsa.pub.
The key fingerprint is:
74:20:65:73:47:1c:cb:ba:5d:9b:5d:56:cf:91:1a:1a backuppc@server1.example.com
  • Copiare /var/lib/backuppc/.ssh/id_rsa.pub sul server da backuppare
sudo cp /var/lib/backuppc/.ssh/id_rsa.pub /tmp
scp /tmp/id_rsa.pub myclient:/tmp
  • Sulla macchina da backuppare, aggiungere questa chiave per far accedere l'utente come root (o administrator)
cat /tmp/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys
  • Dal server backuppc, controllare che l'utente backuppc possa loggarsi via ssh senza password su server da backuppare
sudo -u backuppc ssh root@myclient
  • Lanciare un backup di prova da commandline:
sudo -u backuppc /usr/share/backuppc/bin/BackupPC_dump -v -f myclient

Configurazione del backup di un host via Samba

Inserire il nome (netbios) del pc da backuppare:

echo rosnotcri   0       backuppc, cristina.rossi | sudo tee -a /etc/backuppc/hosts > /dev/null

Creare il file di configurazione scegliendo cosa backuppare:

cat | sudo tee /etc/backuppc/rosnotcri.pl < /dev/null <<'EOFile'
#
# SMB Backup
#
# Minimum period in days between full and incremental backups:
# 1 Full alla settimana
$Conf{FullPeriod} = 6.97;
# 2 o almeno un incr al giorno
$Conf{IncrPeriod} = 0.24;

# Number of full and incremental backups to keep:
$Conf{FullKeepCnt} = 2;
$Conf{IncrKeepCnt} = 12;
# Note that additional fulls will be kept for as long as is necessary
# to support remaining incrementals.

# What transport to use backup the client [smb|rsync|rsyncd|tar|archive]:
$Conf{XferMethod} = 'smb';
$Conf{SmbShareName} = [ 'C$', 'D$' ];
$Conf{SmbShareUserName} = 'administrator';
$Conf{SmbSharePasswd} = 'lapassword';

# If this is defined only these files/paths will be included in the backup:
#$Conf{BackupFilesOnly} = undef;
#
$Conf{BackupFilesOnly} = {
        'C$' => ['/Documents and Settings/cristina.rossi'],
        'D$' => ['/Documenti'],
                 };

# Level of verbosity in Xfer log files:
$Conf{XferLogLevel} = 1;

# Compression level to use on files. 0 means no compression. See notes
# in main config file before changing after backups have already been done.
$Conf{CompressLevel} = 3;

# The backup may occur over vpn. Avoid "ping too slow" errors.
$Conf{PingMaxMsec} = 150;

# Timeout if backing up large files ?
$Conf{ClientTimeout} = 3600*8;      # 6 Hours
EOFile

Cambiare le permission per nascondere le password

sudo chown backuppc\: /etc/backuppc/*.pl
sudo chmod o= /etc/backuppc/*.pl

Riavviare backuppc

sudo /etc/init.d/backuppc restart

Controllare via web che l'host sia presente

Configurazione dell'accesso SAMBA sulla macchina da backuppare

  • Il tutto vale per Windows XP PROFESSIONAL. Per XP Home non va.
  • Assicurarsi di poter accedere con utente e password alle condivisoni
  • Se si usano C$ e D$, assicurarsi di aver disabilitato la "Condivisione files semplice" da "Strumenti - Opzioni Cartella - Visulizzazione - Impostazioni avanzate" di Explorer.

Lanciare un backup di prova da commandline:

sudo -u backuppc /usr/share/backuppc/bin/BackupPC_dump -v -f rosnotcri

Riferimenti