Installazione e Configurazione di BackupPc: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
No edit summary
m Wheezy update
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Stub}}
==Installazione ==
==Installazione ==


  sudo apt-get install backuppc rsync libfile-rsyncp-perl par2 smbfs apache2
* Installare pacchetti
  sudo apt-get install backuppc rsync libfile-rsyncp-perl par2 apache2 postfix


Cambiare la password di default per l'accesso a backuppc:
* Cambiare la password di default per l'accesso a backuppc:


  sudo htpasswd /etc/backuppc/htpasswd backuppc
  sudo htpasswd /etc/backuppc/htpasswd backuppc


Se installa anche apache, rimuoverlo:
* Loggarsi con backuppc/password_impostata http://myserver/backuppc (attivare javascript !!!)
sudo apt-get remove --purge apache apache-common
sudo rm -rf /etc/apache
 
Installare il file di configurazione di backuppc in apache2
cd /etc/apache2/sites-available/
sudo ln -s /etc/backuppc/apache.conf backuppc
sudo touch /etc/apache2/httpd.conf
 
Attivare la configurazione
sudo a2ensite backuppc
 
Impostare l'autostart di apache2
 
<pre>
cat | sudo tee /etc/default/apache2 > /dev/null <<EOFile
# 0 = start on boot; 1 = don't start on boot
NO_START=0
EOFile
</pre>
 
Riavviare apache 2
sudo /etc/init.d/apache2 restart
 
Testare apache2
* Vedere se mostra "It worls !" http://fireber


Testare backuppc
* Loggarsi con backuppc/password_impostata http://fireber/backuppc (attivare javascript !!!)
* Lanciare un backup di localhost dall'interfaccia
* Lanciare un backup di localhost dall'interfaccia


Line 50: Line 22:


Inserire il nome del pc da backuppare:
Inserire il nome del pc da backuppare:
  echo berserver   1      backuppc | sudo tee -a /etc/backuppc/hosts > /dev/null
  echo myclient   1      backuppc | sudo tee -a /etc/backuppc/hosts > /dev/null


Creare il file di configurazione scegliendo cosa backuppare:
Creare il file di configurazione scegliendo cosa backuppare:


<pre>
<pre>
cat | sudo tee /etc/backuppc/berserver.pl < /dev/null <<'EOFile'
cat | sudo tee /etc/backuppc/myclient.pl < /dev/null <<'EOFile'
#
#
# Rsync over ssh Backup
# Rsync over ssh Backup
Line 63: Line 35:
$Conf{FullPeriod} = 6.97;
$Conf{FullPeriod} = 6.97;
# 2 o almeno un incr al giorno
# 2 o almeno un incr al giorno
$Conf{IncrPeriod} = 0.24;
$Conf{IncrPeriod} = 0.49;


# Number of full and incremental backups to keep:
# Number of full and incremental backups to keep:
$Conf{FullKeepCnt} = 2;
$Conf{FullKeepCnt} = 5;
$Conf{IncrKeepCnt} = 12;
$Conf{IncrKeepCnt} = 32;
# Note that additional fulls will be kept for as long as is necessary
# Note that additional fulls will be kept for as long as is necessary
# to support remaining incrementals.
# to support remaining incrementals.
Line 76: Line 48:
# The file system path or the name of the rsyncd module to backup when
# The file system path or the name of the rsyncd module to backup when
# using rsync/rsyncd:
# using rsync/rsyncd:
#Conf{RsyncShareName} = '/home/diesis';
$Conf{RsyncShareName} = '/';
$Conf{RsyncShareName} = '/';


# If this is defined only these files/paths will be included in the backup:
# If this is defined only these files/paths will be included in the backup:
#$Conf{BackupFilesOnly} = undef;
#$Conf{BackupFilesOnly} = undef;
$Conf{BackupFilesOnly} = ['/mnt/f/Apps/Symphony',
                          '/mnt/c/tmp'];


# These files/paths will be excluded from the backup:
# These files/paths will be excluded from the backup:
$Conf{BackupFilesExclude} = ['/home/diesis/.cxoffice/win98/drive_c/Windows/Temporary Internet Files/Content.IE5',
$Conf{BackupFilesExclude} = ['/proc',
                        '/home/diesis/.thumbnails',
                      '/dev',
                        '/home/diesis/core.*',
                      '/cdrom',
                        '/home/diesis/.core*',
                      '/floppy',
                        '/home/diesis/.Trash',
                      '/mnt',
                        '/home/diesis/.ies4linux',
                      '/var/lib/backuppc',
                        '/home/diesis/.evolution/cache/http',
                      '/lost+found',
                        '/home/diesis/.evolution/cache/tmp',
                      '/var/spool/squid',
                        '/home/diesis/.evolution/mail/imap/*/folders',
                      '/var/spool/squid3',
                        '/home/diesis/.evolution/mail/imap4/*/folders',
                      '/sys'];
                        '/home/diesis/.evolution/mail/nntp/*/cache',
                        '/home/diesis/.opensync/group?/?/enginepipe',
                        '/home/diesis/.opensync/group?/?/pluginpipe'];
#
#$Conf{BackupFilesExclude} = ['/proc',
#                      '/dev',
#                      '/cdrom',
#                      '/floppy',
#                      '/mnt',
#                      '/var/lib/backuppc',
#                      '/lost+found',
#                      '/media/hda4/Install',
#                      '/media/hda4/Recycled',
#                      '/home/diesis/.cxoffice/win98/drive_c/Windows/Temporary Internet Files/Content.IE5',
#                      '/home/diesis/.thumbnails',
#                      '/home/diesis/core.*',
#                      '/home/diesis/.core*',
#                      '/home/diesis/.Trash',
#                      '/home/diesis/.ies4linux',
#                      '/home/diesis/.evolution/cache/http',
#                      '/home/diesis/.evolution/cache/tmp',
#                      '/home/diesis/.evolution/mail/imap/*/folders',
#                      '/home/diesis/.evolution/mail/imap4/*/folders',
#                      '/home/diesis/.evolution/mail/nntp/*/cache',
#                      '/home/diesis/.opensync/group?/?/enginepipe',
#                      '/home/diesis/.opensync/group?/?/pluginpipe'];


# Level of verbosity in Xfer log files:
# Level of verbosity in Xfer log files:
Line 127: Line 70:
# Commands to run for client backups:
# Commands to run for client backups:
# Note the use of SSH's -C attribute. This enables compression in SSH.
# 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+';
#$Conf{RsyncClientCmd} = '$sshPath -C -x -l administrator -o PreferredAuthentications=publickey $host $rsyncPath $argList+';


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


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


# The backup may occur over vpn. Avoid "ping too slow" errors.
# The backup may occur over vpn. Avoid "ping too slow" errors.
Line 144: Line 87:
EOFile
EOFile
</pre>
</pre>
sudo chown backuppc\: /etc/backuppc/berserver.pl
sudo chmod o= /etc/backuppc/berserver.pl


Riavviare backuppc
sudo /etc/init.d/backupp restart


Controllare via web che l'host sia presente
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===
===Configurazione dell'accesso ssh sulla macchina da backuppare===


Creare la chiave privata di backuppc sul server backuppc
* Creare la chiave privata di backuppc sul server backuppc
sudo -i -u backuppc ssh-keygen -t rsa
 
<pre>
<pre>
sudo su backuppc
ssh-keygen -t rsa
Generating public/private rsa key pair.
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa): <-- <ENTER>
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa): <-- <ENTER>
Line 170: Line 114:
</pre>
</pre>


Copiare /var/lib/backuppc/.ssh/id_rsa.pub sul server da backuppare
* Copiare /var/lib/backuppc/.ssh/id_rsa.pub sul server da backuppare


<pre>
<pre>
sudo cp /var/lib/backuppc/.ssh/id_rsa.pub /tmp
sudo cp /var/lib/backuppc/.ssh/id_rsa.pub /tmp
scp /tmp/id_rsa.pub administrator@berserver:/tmp
scp /tmp/id_rsa.pub myclient:/tmp
</pre>


* 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


Sul server da backuppare, aggiungere questa chiave per l'utente
* Dal server backuppc, controllare che l'utente backuppc possa loggarsi via ssh senza password su server da backuppare
<pre>
sudo -u backuppc ssh root@myclient
Administrator@berserver ~
$ cat /home/Administrator/id_rsa.pub >> .ssh/authorized_keys
 
Controllare che l'utente backuppc possa loggarsi via ssh senza password su server da backuppare
<pre>
mnt.vvngrl@fireber:/tmp$ sudo -u backuppc ssh administrator@berserver
The authenticity of host 'berserver (192.168.0.100)' can't be established.
RSA key fingerprint is 2c:b3:8f:b4:2f:1e:e2:26:4b:d0:3b:34:01:69:79:51.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'berserver,192.168.0.100' (RSA) to the list of known hosts.
Last login: Thu Sep 20 11:14:42 2007 from rvmnot003
 
Administrator@berserver ~
$ exit
logout
Connection to berserver closed.
</pre>
 
Lanciare un backup di prova da commandline:
sudo -u backuppc /usr/share/backuppc/bin/BackupPC_dump -v -f berserver


* 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==
==Configurazione del backup di un host via Samba==
Line 260: Line 189:


Riavviare backuppc
Riavviare backuppc
  sudo /etc/init.d/backupp restart
  sudo /etc/init.d/backuppc restart


Controllare via web che l'host sia presente
Controllare via web che l'host sia presente

Latest revision as of 08:24, 30 September 2014

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