BACKUP - Installation de backuppc sur Corni

De PedroWiki

Introduction

Article "bloc-note" sur l'installation de BackupPC sur Corni (home.peaudeau.fr).

Objectif:

  • Assurer les backups de rps.pedrono.fr

Installation de BackupPC

Téléchargement des sources

Il n'existe pas de distribution packagée pour Debian/Ubuntu. L'installation se fera donc à partir des sources.

Téléchargement:

jules@corni:/home/jules$ wget http://www.zmanda.com/downloads/community/BackupPC/3.1.1beta/Source/BackupPC-3.1.1beta.tar.gz

Décompression:

jules@corni:/home/jules$ tar xvzf BackupPC-3.1.1beta.tar.gz

Lancement de l'installation

jules@corni:/home/jules/BackupPC-3.1.1beta$ sudo perl ./configure.pl 
[sudo] password for jules: 

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: /etc/BackupPC/config.pl).  Otherwise, just
hit return.

--> Full path to existing main config.pl []? 

I found the following locations for these programs:

    bzip2        => /bin/bzip2
    cat          => /bin/cat
    df           => /bin/df
    gtar/tar     => /bin/tar
    gzip         => /bin/gzip
    hostname     => /bin/hostname
    nmblookup    => /usr/bin/nmblookup
    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 [corni]? home.peaudeau.fr

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.
The data directories and files will have group read permission,
so group members can access backup files.

--> BackupPC should run as user [backuppc]? 

getpwnam() says that user backuppc doesn't exist.  Please
check the name and verify that this user is in the passwd file.

Dans un autre terminal:

jules@corni:~$ sudo useradd backuppc
[sudo] password for jules: 
jules@corni:~$ sudo passwd backuppc
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
jules@corni:~$ 

ATTENTION RESTE A CHOISIR LE BON GROUPE POUR LE USER BACKUPPC

Suite de l'installer:

Please specify an install directory for BackupPC.  This is where the
BackupPC scripts, library and documentation will be installed.

--> Install directory (full path) [/usr/local/BackupPC]?

Please specify a data directory for BackupPC.  This is where all the
PC backup data is stored.  This file system needs to be big enough to
accommodate all the PCs you expect to backup (eg: at least several GB
per machine).

--> Data directory (full path) [/data/BackupPC]? 
BackupPC can use FTP as a transfer protocol.  for this, BackupPC needs
the module Net::FTP::RetrHandle, and highly recommends using
Net::FTP::AutoReconnect.  However, these packages have not made their
way onto the Fedora or Red Hat package servers from CPAN
yet. Net::FTP::AutoReconnect and Net::FTP::RetrHandle have been
bundled with this distribution for use only with BackupPC.

--> Install CPAN Net::FTP::* modules? [y]? 

BackupPC can compress pool files, but it needs the Compress::Zlib
package installed (see www.cpan.org). Compression will provide around a
40% reduction in pool size, at the expense of cpu time.  You can leave
compression off and run BackupPC without compression, in which case you
should leave the compression level at 0 (which means off).  You could
install Compress::Zlib and turn compression on later, but read the
documentation first about how to do this.  Or the better choice is
to quit, install Compress::Zlib, and re-run configure.pl.

--> Compression level [0]? 

Dans un autre terminal, configuration de cpan et installation de Compress::Zlib:

jules@corni:~$ cpan
...
=> Suivi des instruction

La configuration de cpan requiert l'installation d'utilitaires:

jules@corni:~$ sudo apt-get install unzip
jules@corni:~$ sudo apt-get install lynx
jules@corni:~$ sudo apt-get install ncftp

Reprise de l'installer:

--> Compression level [0]? 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) []? /home/jules/www/cgi/

BackupPC's CGI script needs to display various GIF images that
should be stored where Apache can serve them.  They should be
placed somewhere 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) []? /home/jules/www/backuppc 
--> URL for image directory (omit http://host; starts with '/') []? /backuppc

Ok, we're about to:

  - install the binaries, lib and docs in /usr/local/BackupPC,
  - create the data directory /data/BackupPC,
  - create/update the config.pl file /etc/BackupPC/config.pl,
  - optionally install the cgi-bin interface.

--> Do you want to continue? [y]? y
Created /usr/local/BackupPC/bin
Created /usr/local/BackupPC/doc
Created /usr/local/BackupPC/lib/BackupPC/CGI
Created /usr/local/BackupPC/lib/BackupPC/Config
Created /usr/local/BackupPC/lib/BackupPC/Lang
Created /usr/local/BackupPC/lib/BackupPC/Storage
Created /usr/local/BackupPC/lib/BackupPC/Xfer
Created /usr/local/BackupPC/lib/BackupPC/Zip
Created /usr/local/BackupPC/lib/Net/FTP
Created /home/jules/www/backuppc
Created /data/BackupPC
Created /data/BackupPC/pool
Created /data/BackupPC/cpool
Created /data/BackupPC/pc
Created /data/BackupPC/trash
Created /etc/BackupPC
Created /var/log/BackupPC
Installing binaries in /usr/local/BackupPC/bin
Installing library in /usr/local/BackupPC/lib
/usr/local/BackupPC/lib/Net/FTP/AutoReconnect.pm installed
/usr/local/BackupPC/lib/Net/FTP/RetrHandle.pm installed
Installing images in /home/jules/www/backuppc
Making init.d scripts
Making Apache configuration file for suid-perl
Installing docs in /usr/local/BackupPC/doc
Installing config.pl and hosts in /etc/BackupPC
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.070 ms

--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.070/0.070/0.070/0.000 ms
Installing cgi script BackupPC_Admin in /home/jules/www/cgi/

Ok, it looks like we are finished.  There are several more things you
will need to do:

  - Browse through the config file, /etc/BackupPC/config.pl,
    and make sure all the settings are correct.  In particular,
    you will need to set $Conf{CgiAdminUsers} so you have
    administration privileges in the CGI interface.

  - Edit the list of hosts to backup in /etc/BackupPC/hosts.

  - Read the documentation in /usr/local/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.
    If this is an upgrade and you are using mod_perl, you will need
    to restart Apache.  Otherwise it will have stale code.

  - 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!
jules@corni:/home/jules/BackupPC-3.1.1beta$

Configuration post installation

  • Création d'un script alias dans /etc/apache2/sites-available/default + restart apache.
  • Copie de /home/jules/BackupPC-3.1.1beta/init.d/debian-backuppc vers /etc/init.d/backuppc.
  • Tentatives de démarrage de BackupPC:
/etc/init.d/backuppc start HS, pb de droits.
  • Modification des droits sur les dossiers:
chown -R backuppc: /data/ => démarrage OK.
sudo usermod -a -G backuppc www-data
chmod g+x /home/jules/www/cgi/
chmod g+w /home/jules/www/cgi/
Erreur: Mauvais utilisateur: mon userid est 33, à la place de 1005 (backuppc)

This script needs to run as the user specified in $Conf{BackupPCUser}, which is set to backuppc.

This is an installation problem. If you are using mod_perl then it appears that Apache is not running as user backuppc. If you are not using mod_perl, then most like setuid is not working properly on BackupPC_Admin. Check the permissions on /home/jules/www/cgi//BackupPC_Admin and look at the documentation.