Linux-Ubuntu [snippet] : Using Rsync

How to synchronize your local server into remote server?

It’s my question to, I usually just copy paste from my local server to remote server, and it’s something that bored. So I found rsync (that github use), and here’s my little snippet about it.

There is 2 step to make rsync ready.

  1. Set up rsync daemon in your remote server.
  2. Use the rsync in your local server.

Also don’t forget to install rsync, apt-get install rsync

First Step :

root$remote_server : vim /etc/rsync.d
# put this line
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[simple_path_name]
   path = /rsync_files_here
   comment = My Very Own Rsync Server
   uid = nobody
   gid = nobody
   read only = no
   list = yes
   auth users = username
   secrets file = /etc/rsyncd.scrt

root$remote_server : rsync --daemon

Second step

root$local_server : rsync -avz /path/to/local/folder/ root@49.60.10.39:/path/to/remote/folder/

And, your folder is synced in remote server.

References :

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s