201601.25
Désactivé
0

Backuppc

Installation Backuppc

If you want to change the backuppc password :

htpasswd /etc/backuppc/htpasswd backuppc
Tutorial utilisé : http://www.serveur-monty.net/cours/howto/howto_backuppc.pdf (bon guide mais plein d'erreurs)

Installer BackupPc

Backuppc fait partie de debian, donc installation : apt-get install backuppc (originally aptitude mais IspConfig utilise apt-get)
Accepter 'Apache2'
Exemple sauv1.clight.fr :
Notez url, user et mot de passe :

  • Web administration default user created : BackupPC can be managed through its web interface:
  • http://sauv1.clight.fr/backuppc/

For that purpose, a web user named 'backuppc' with 'vyYbed9m' as password has been created.
You can change this password by running 'htpasswd /etc/backuppc/htpasswd backuppc'.

Paramétrer BackupPc

DONT FORGET : check “Override” and save.
Lancer BackupPc : http://sauv1.clight.fr/backuppc/
Edit Hosts
Add : mut8.clight.fr, user = backuppc (Save)
Delete : Localhost (Save)
Vous etes sur : Main Configuration Editor, qu'il convient de configurer en tant que defaut :
Xfer : XferMethod = rsync (Save)
Email : EMailAdminUserName : contact@cergy-internet.fr (Save)
Serveur : Host : sauv1.clight.fr
Schedule : BlackoutPeriods : hourEnd : 23
FullKeepCnt :4, 0, 13, 0, 0, 100(Save)
Select a host : mut8.clight.fr
Edit Config
Xfer : RsyncShareName : (check override ) :

  • /var/www/clients
  • /var/backups/mysql
  • /var/vmail (Save)

Backup settings :
DumpPreUserCmd : $sshPath -q -x -l root $host ./backup_mysql (Override and Save)

Créer ssh accès

The machine running backuppc is the server (sauv1), put it on the left, the machine to be backed-up is the client (mut8), put it on the right.
Login as root on client and server
ssh -v OR sshd -v (Ubuntu 14.04) on both client and server to check we are using OpenSSH.
ON CLIENT(Right) :
ssh-keygen -t rsa
ENTER 3 times, and get “The key's randomart image is”
ON SERVER(Left)
find / -name BackupPC_id_rsa.pub (to check if key already exists.

Nota 5/3/2016 : on sauv1 it is at /var/lib/backuppc/.ssh/BackupPC_id_rsa.pub instead of ~/.ssh/BackupPC_id_rsa.pub -why?

Nota 19/10/2016 : actually both dirs .ssh exist. The known hosts to use is the one at ~/.ssh
if not create it and make a copy :

  • su backuppc
  • prompt is like “sh-4.2$”, so whoami to check you are backuppc (no password required)

ssh-keygen -t rsa
ENTER 3 times, and get “The key's randomart image is”
cp ~/.ssh/id_rsa.pub ~/.ssh/BackupPC_id_rsa.pub
exit (exit user backppc to return to root)
Once server key made copy it into client :
CLIENT(Right) : vim ~/.ssh/authorized_keys2 (should be empty)
SERVER(Left) : cat /var/lib/backuppc/.ssh/BackupPC_id_rsa.pub (to display key ready for copy)
Manually copy contents of SERVER:BackupPC_id_rsa.pub to CLIENT:~/.ssh/authorized_keys2 and save
for more security should do (but I didn't)… from=“backuppc.my.com” ssh-rsa [base64 key, eg: ABwBCEAIIALyoqa8….]

Now we need to copy client key into server knownhosts :

SERVER(Left) :
mkdir .ssh
vim ~/.ssh/known_hosts (attn for sauve1, voir ci-dessus - 14/01/2017 this is all still unclear. In fact I think when you do below ssh -l root mut8.clight.fr whoami I think it adds you in the right place - I don't know where)

CLIENT(Right) : cat /root/.ssh/id_rsa.pub
Manually copy contents of CLIENT:/root/.ssh/id_rsa.pub to SERVER:~/.ssh/known_hosts and save

SERVER(Left)
su backuppc
ssh -l root mut8.clight.fr whoami
» Warning: Permanently added 'zimbra.clight.fr,82.112.98.142' (ECDSA) to the list of known hosts.
yes
If you get : “* Failed to add the host to the list of known hosts (/var/lib/backuppc/.ssh/known_hosts).” :
chmod 777 /var/lib/backuppc/.ssh/known_hosts
ssh -l root mut8.clight.fr whoami
» root (ok !) Nota19/10/2016 - if it asks for a passwork it's failed. It should comme back just "root" immediately.
Now create database back up script as below

Documentation Ubuntu :

http://doc.ubuntu-fr.org/backuppc#sauvegarder_un_poste_linux_distant_via_rsync_ssh
Dans BackupPc, menu gauche, Documentation, Step 5: Client Setup : http://mut1.clight.fr/backuppc/index.cgi?action=view&type=docs#step_5__client_setup
SSH Setup : http://backuppc.sourceforge.net/faq/ssh.html
Edit

Créer MySQL backup script

Copy the contents of the script from a similaire machine :
EXISTING CLIENT : cat ~/backup_mysql
CLIENT : vim ~/backup_mysql
Copy across manually
Check list of ignored files is correct : IGGY=“information_schema mysql performance_schema”
chmod 777 ~/backup_mysql
mkdir /var/backups/mysql (to contain backups)

Test backup :

cd ~
./backup_mysql
ls -al /var/backups/mysql (to check if tables have been backed up)
rm /var/backups/mysql/*.gz (remove tests for full backup test)

Tester backup

ON SERVEUR : BackuPc, Select a host : mut8.clight.fr
Start full backup

If the ping fails (set normally to 20ms, change to 100ms and try again)