Diferencia entre revisiones de «Rdiff-backup»
De gacq wiki
(Página nueva: apt-get install rdiff-backup python-xattr python-pylibacl) |
|||
Línea 1: | Línea 1: | ||
+ | = Simple automatic incremental daily backup using rdiff-backup = | ||
+ | == The script == | ||
+ | Put the backup script on /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh | ||
− | apt-get install rdiff-backup python-xattr python-pylibacl | + | <pre> |
+ | HOSTNAME=vtiger1.aiki-translations.com | ||
+ | |||
+ | rdiff-backup \ | ||
+ | --print-statistics \ | ||
+ | --remote-schema "ssh -i /srv/backups/rdiff-backups/id_rsa-$HOSTNAME -C %s 'sudo /usr/bin/rdiff-backup --server --restrict-read-only /'" \ | ||
+ | --preserve-numerical-ids \ | ||
+ | --verbosity 4 \ | ||
+ | --force \ | ||
+ | --include /etc \ | ||
+ | --include /home \ | ||
+ | --exclude / \ | ||
+ | backup@$HOSTNAME::/ $HOSTNAME | ||
+ | </pre> | ||
+ | |||
+ | == On server to backup == | ||
+ | <pre> | ||
+ | apt-get install rdiff-backup python-xattr python-pylibacl sudo | ||
+ | mkdir /var/backups/.ssh | ||
+ | </pre> | ||
+ | |||
+ | add to /etc/sudoers | ||
+ | <pre> | ||
+ | backup ALL = NOPASSWD: /usr/bin/rdiff-backup --server --restrict-read-only / | ||
+ | </pre> | ||
+ | |||
+ | == On backup server == | ||
+ | ;Run as root | ||
+ | <pre> | ||
+ | HOSTNAME=SERVER_TO_BACKUP | ||
+ | |||
+ | mkdir -p /srv/backups/rdiff-backups/$HOSTNAME | ||
+ | apt-get install rdiff-backup python-xattr python-pylibacl | ||
+ | ssh-keygen -t rsa -N "" -f /srv/backups/rdiff-backups/id_rsa-$HOSTNAME | ||
+ | cat /srv/backups/rdiff-backups/id_rsa-$HOSTNAME.pub | ssh root@$HOSTNAME 'cat - > /var/backups/.ssh/authorized_keys' | ||
+ | |||
+ | chown root:root /srv/backups/rdiff-backups/id_rsa-$HOSTNAME | ||
+ | chmod 600 /srv/backups/rdiff-backups/id_rsa-$HOSTNAME | ||
+ | chown root:root /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh | ||
+ | chmod 750 /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh | ||
+ | |||
+ | echo "0 4 * * * root /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh" > /etc/cron.d/$HOSTNAME-rdiff-backup | ||
+ | /etc/init.d/cron restart | ||
+ | </pre> |
Revisión del 17:03 6 oct 2008
Contenido
Simple automatic incremental daily backup using rdiff-backup
The script
Put the backup script on /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh
HOSTNAME=vtiger1.aiki-translations.com rdiff-backup \ --print-statistics \ --remote-schema "ssh -i /srv/backups/rdiff-backups/id_rsa-$HOSTNAME -C %s 'sudo /usr/bin/rdiff-backup --server --restrict-read-only /'" \ --preserve-numerical-ids \ --verbosity 4 \ --force \ --include /etc \ --include /home \ --exclude / \ backup@$HOSTNAME::/ $HOSTNAME
On server to backup
apt-get install rdiff-backup python-xattr python-pylibacl sudo mkdir /var/backups/.ssh
add to /etc/sudoers
backup ALL = NOPASSWD: /usr/bin/rdiff-backup --server --restrict-read-only /
On backup server
- Run as root
HOSTNAME=SERVER_TO_BACKUP mkdir -p /srv/backups/rdiff-backups/$HOSTNAME apt-get install rdiff-backup python-xattr python-pylibacl ssh-keygen -t rsa -N "" -f /srv/backups/rdiff-backups/id_rsa-$HOSTNAME cat /srv/backups/rdiff-backups/id_rsa-$HOSTNAME.pub | ssh root@$HOSTNAME 'cat - > /var/backups/.ssh/authorized_keys' chown root:root /srv/backups/rdiff-backups/id_rsa-$HOSTNAME chmod 600 /srv/backups/rdiff-backups/id_rsa-$HOSTNAME chown root:root /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh chmod 750 /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh echo "0 4 * * * root /srv/backups/rdiff-backups/$HOSTNAME-rdiff-backup.sh" > /etc/cron.d/$HOSTNAME-rdiff-backup /etc/init.d/cron restart