Rsync - How to backup your server the right way!
December 4th, 2008
Describe How to Set Up Rsync here.install rsync on both client and server. they should have the same versions of rsync installed.
$apt-get install rsync
Create new ssh key w/out password
$ssh-keygen -f rsync_key -C 'Rsync Key' -N '' -t rsa -q
copy key to server
ssh-copy-id -i /home/user/.ssh/rsync_key.pub jesterj@server jesterj@server's password: Now try logging into the machine, with "ssh 'jesterj@server'", and check in: .ssh/authorized_keys
test login with specified key
slogin -i ~/.ssh/rsync_key backupuser@server1
Make sure rsync is running.
/etc/init.d/rsync start
Test from local machine to verify you can connect:
$ rsync -e ssh localhost::
Now run this command from backup server to sync files. the ‘n’ aoption does a test run. remove it to do an actual sync.
rsync -van --delete --ignore-errors -e "ssh -i /home/user/.ssh/rsync_key" /source/path jesterj@server:/backup/path
Add command to cron to repeat. *The '--delete' means to delete items that don't exist in the backup location, --ignore-errors, continues the backup even though errors exist.