How to Mirroring / Remote Backup Using rsync on Debian Squeeze

Below is guide how to remote backup using rsync.

1. Install rsync on both client and remote computer:

$ sudo apt-get install rsync

2. Create config file /etc/rsyncd.conf on remote computer:

$ sudo nano /etc/rsyncd.conf

And put these lines into the file:

motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[gudang]
path = /home/www-metal/ebook/
comment = My Very Own Rsync Server
uid = www-metal
gid = www-metal
read only = no
list = yes
#hosts allow = 222.165.93.251

Press Ctrl-X, Y, and Enter to exit from nano.

3. Activate rsync

$ sudo nano /etc/default/rsync

FindĀ RSYNC_ENABLE=false line, and change to RSYNC_ENABLE=true

4. Execute rsync

$ sudo /etc/init.d/rsync start

5. And then from client computer, execute this command to get files from remote computer:

$ rsync -avz colekcolek.com::gudang /home/ebook

This command will download (sync) all files in /home/www-metal/ebook on remote computer (colekcolek.com) and save it (sync) to /home/ebook on client computer.

6. Create scheduled job to do sync everyday at 3 am.

$ sudo crontab -e

And type in this line:

0 3 * * * rsync -az colekcolek.com::gudang /home/ebook > /dev/null 2>&1

2 thoughts on “How to Mirroring / Remote Backup Using rsync on Debian Squeeze

  1. Don’t forget about “lsyncd”, a live sync daemon that uses rsync. While it may not be the solution for every scenario, most people who land on this page are probably looking for the functionality it provides (real time vs. scheduled job).

    It uses inotify to determine when files change, something that’s most likely running on your linux system anyway.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.