kb:linux:donnees:backup_avec_backuppc
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
kb:linux:donnees:backup_avec_backuppc [2019/01/11 17:10] – [BackupPC 4 :] beu | kb:linux:donnees:backup_avec_backuppc [2020/01/24 08:21] (Version actuelle) – beu | ||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
====Installation de BackupPC==== | ====Installation de BackupPC==== | ||
- | === BackupPC 3.4 :==== | + | === BackupPC 3.3 :==== |
- | BackupPC 3.4 est disponible sur les dépôts officiel de Debian: | + | BackupPC 3.3 est disponible sur les dépôts officiel de Debian: |
<code bash> | <code bash> | ||
Ligne 89: | Ligne 89: | ||
==== BackupPC 4 :==== | ==== BackupPC 4 :==== | ||
- | Attention, cela nécessite de compiler le packet. | + | Attention, cela nécessite de compiler le packet. |
- | On commence par installer les dépendances nécessaires : | + | <code bash backuppc4-setup.sh> |
+ | #!/bin/bash | ||
- | <code bash> | + | if [[ $EUID -ne 0 ]]; then |
- | apt-get install -y apache2 apache2-utils libapache2-mod-perl2 glusterfs-client par2 perl smbclient rsync tar sendmail gcc zlib1g zlib1g-dev libapache2-mod-scgi rrdtool git make perl-doc libarchive-zip-perl libfile-listing-perl libxml-rss-perl libcgi-session-perl | + | echo "This script must be run as root" |
- | </ | + | exit 1 |
+ | fi | ||
- | On créer le dossier qui contiendra les fichiers BackupPC : | + | echo -e " |
+ | read -n 1 -s -r -p "Press any key to continue" | ||
+ | echo "PURGE DE BACKUPPC ET AJOUT DES DÉPENDENCES" | ||
+ | apt remove backuppc | ||
+ | apt-get install -y par acl libacl1-dev apache2 apache2-utils libapache2-mod-perl2 glusterfs-client par2 perl smbclient rsync tar gcc zlib1g zlib1g-dev libapache2-mod-scgi rrdtool git make perl-doc libarchive-zip-perl libfile-listing-perl libxml-rss-perl libcgi-session-perl libtime-parsedate-perl | ||
- | < | + | if [ ! -d "/ |
- | # mkdir / | + | mkdir / |
- | </code> | + | echo " |
+ | adduser --system --home / | ||
+ | mkdir -p / | ||
+ | | ||
+ | echo -e " | ||
+ | chmod 700 / | ||
+ | fi | ||
- | Puis on créer l' | + | pushd `mktemp -d` |
+ | mkdir backuppc | ||
- | <code bash> | + | echo " |
- | # adduser | + | curl -s https:// |
- | </code> | + | curl -s https://api.github.com/ |
+ | curl -s https://api.github.com/ | ||
- | Ensuite on créer les clés ssh: | + | echo " |
+ | tar -xzf backuppc-xs.tar.gz -C backuppc-xs/ | ||
+ | cd backuppc-xs/ | ||
+ | perl Makefile.PL | ||
+ | make | ||
+ | make test | ||
+ | make install | ||
+ | cd ../../ | ||
- | <code bash> | + | echo " |
- | # mkdir -p /var/lib/ | + | tar -xzf rsync-bpc.tar.gz -C rsync-bpc/ |
- | </code> | + | cd rsync-bpc/*/ |
+ | ./configure | ||
+ | make | ||
+ | make install | ||
+ | cd ../../ | ||
- | <code bash> | + | echo " |
- | # ssh-keygen | + | tar -xzf backuppc.tar.gz |
- | </code> | + | cd backuppc/ |
+ | if [ -f "/ | ||
+ | systemctl stop backuppc | ||
+ | ./ | ||
+ | popd | ||
+ | systemctl start backuppc | ||
+ | else | ||
+ | ./ | ||
+ | echo " | ||
+ | cp systemd/ | ||
+ | sed -i "s/{CgiAdminUsers} | ||
+ | systemctl enable --now backuppc | ||
- | <code bash> | + | echo "CONFIGURATION D' |
- | # echo -e "BatchMode yes\nStrictHostKeyChecking no" > /var/lib/backuppc/.ssh/config | + | cat << EOF > /etc/apache2/sites-available/001-backuppc.conf |
- | </code> | + | <VirtualHost *:80> |
+ | DocumentRoot / | ||
- | Et on redéfinit les droits : | + | Alias /hw / |
- | <code bash> | + | |
- | chmod 700 /var/lib/backuppc/.ssh && chmod 600 / | + | |
- | </ | + | Allow from all |
- | On git clone ensuite les trois dépôts de BackupPC : | + | Options ExecCGI FollowSymlinks |
+ | DirectoryIndex BackupPC_Admin | ||
- | <code bash> | + | |
- | # git clone https:// | + | SetHandler cgi-script |
- | </ | + | </ |
- | + | AuthUserFile / | |
- | Ensuite pour chaque packets : | + | AuthType basic |
- | + | AuthName " | |
- | === backuppc-xs : === | + | require valid-user |
- | + | </ | |
- | <code bash> | + | |
- | # cd backuppc-xs | + | |
- | </ | + | |
- | <code bash> | + | |
- | # git tag | tail -1 | xargs git checkout | + | |
- | </ | + | |
- | <code bash> | + | |
- | # perl Makefile.PL | + | |
- | </ | + | |
- | <code bash> | + | |
- | # make | + | |
- | </ | + | |
- | <code bash> | + | |
- | # make test | + | |
- | </ | + | |
- | <code bash> | + | |
- | # make install | + | |
- | </ | + | |
- | <code bash> | + | |
- | # cd .. | + | |
- | </ | + | |
- | === rsync-bpc === | + | |
- | <code bash> | + | |
- | # cd rsync-bpc | + | |
- | </ | + | |
- | <code bash> | + | |
- | # git tag | tail -1 | xargs git checkout | + | |
- | </ | + | |
- | <code bash> | + | |
- | # ./ | + | |
- | </ | + | |
- | <code bash> | + | |
- | # make | + | |
- | </ | + | |
- | <code bash> | + | |
- | # make install | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | === backuppc === | + | |
- | <code bash> | + | |
- | # cd backuppc | + | |
- | </ | + | |
- | <code bash> | + | |
- | # git tag | tail -1 | xargs git checkout | + | |
- | </ | + | |
- | <code bash> | + | |
- | # ./ | + | |
- | </ | + | |
- | <code bash> | + | |
- | # cp systemd/ | + | |
- | </ | + | |
- | <code bash> | + | |
- | # cd .. | + | |
- | </ | + | |
- | + | ||
- | Ensuite on supprime les configurations Apache2 par défaut | + | |
- | + | ||
- | <code bash> | + | |
- | # rm / | + | |
- | </ | + | |
- | + | ||
- | et on injecte cette configuration dans le dossier /// | + | |
- | + | ||
- | <code file backuppc.conf> | + | |
- | < | + | |
- | DocumentRoot / | + | |
- | < | + | |
- | AllowOverride None | + | |
- | Allow from all | + | |
- | + | ||
- | Options ExecCGI FollowSymlinks | + | |
- | DirectoryIndex BackupPC_Admin | + | |
- | + | ||
- | < | + | |
- | SetHandler cgi-script | + | |
- | </ | + | |
- | AuthUserFile / | + | |
- | AuthType basic | + | |
- | AuthName " | + | |
- | require valid-user | + | |
- | </ | + | |
</ | </ | ||
- | </ | ||
- | Ensuite on va demander a Apache2 d'utiliser l' | + | EOF |
+ | sed -i 's/www-data/ | ||
+ | a2dissite 000-default | ||
+ | a2enmod cgid && a2ensite 001-backuppc.conf | ||
- | <code bash> | + | systemctl restart |
- | # sed -i ' | + | |
- | </ | + | |
- | On active les confs et les modules : | + | if [ ! -f "/ |
+ | touch / | ||
+ | htpasswd -b / | ||
+ | fi | ||
- | <code bash> | + | popd |
- | # a2enmod cgid && a2ensite backuppc.conf | + | fi |
- | </ | + | |
- | Ensuite on redémarre apache2 : | + | echo -e "FINI !\nUse the account backuppc with the password ' |
- | + | ||
- | <code bash> | + | |
- | # systemctl restart apache2 | + | |
</ | </ | ||
- | On créer ensuite le fichier de mot de passe : | ||
- | <code bash> | ||
- | # rm / | ||
- | </ | ||
- | |||
- | et ensuite il faut créer un utilisateur | ||
- | |||
- | <code bash> | ||
- | # htpasswd / | ||
- | </ | ||
- | |||
- | et il faudra ajouter ce compte en tant qu' | ||
- | |||
- | <code bash [enable_line_numbers=" | ||
- | # --> administrative users are the union of groups admin and wheel, plus | ||
- | # craig and celia. | ||
- | # | ||
- | # $Conf{CgiAdminUserGroup} = ''; | ||
- | # $Conf{CgiAdminUsers} | ||
- | # --> administrative users are only craig and celia' | ||
- | # | ||
- | $Conf{CgiAdminUserGroup} = ''; | ||
- | $Conf{CgiAdminUsers} = ' | ||
- | |||
- | </ |
kb/linux/donnees/backup_avec_backuppc.1547226636.txt.gz · Dernière modification : 2019/01/11 17:10 de beu