Difference between revisions of "Instalasi dan Konfigurasi rsync"

From OnnoWiki
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Install rsync
 
Install rsync
  
  # apt-get install rsync
+
  apt-get install rsync
  
  
Line 7: Line 7:
  
 
===Edit /etc/default/rsync===
 
===Edit /etc/default/rsync===
 +
 +
Agar rsync aktif dan dapat digunakan, kita perlu mengedit file,
  
 
  vi /etc/default/rsync
 
  vi /etc/default/rsync
Line 13: Line 15:
  
 
  RSYNC_ENABLE=true
 
  RSYNC_ENABLE=true
 
  
 
===Edit /etc/rsyncd.conf===
 
===Edit /etc/rsyncd.conf===
Line 36: Line 37:
 
Buat folder backup
 
Buat folder backup
  
   # mkdir /folder
+
   # mkdir -p /folder/tempat/backup
  # mkdir /folder/tempat
 
  # mkdir /folder/tempat/backup
 
 
   # chown -Rf nobody.nogroup /folder/tempat
 
   # chown -Rf nobody.nogroup /folder/tempat
  
 
Aktifkan rsync daemon
 
Aktifkan rsync daemon
  
  # rsync --daemon
+
  rsync --daemon
 +
 
 +
atau
 +
 
 +
/etc/init.d/rsync restart
 +
 
  
 
Jika perlu masukan ke rc.local
 
Jika perlu masukan ke rc.local
Line 53: Line 57:
 
  /usr/bin/rsync --daemon &
 
  /usr/bin/rsync --daemon &
  
 +
atau
  
 +
/etc/init.d/rsync restart
  
 
==Client==
 
==Client==
Line 62: Line 68:
 
Lakukan
 
Lakukan
  
  # rsync -t -v source destination
+
  rsync -t -v source destination
  
  
 
Contoh untuk Update / Achive dari komputer source  
 
Contoh untuk Update / Achive dari komputer source  
  
  # rsync -ur /home/tempat/data root@192.168.0.1:/home/backup/
+
  rsync -ur /home/tempat/data root@192.168.0.1:/home/backup/
 +
rsync -ur rsync://192.168.0.1/backup/* /home/backup/
 +
 
  
  
Line 78: Line 86:
  
 
  # rsync -av --inplace --rsh='ssh -p1220' foldersrc root@host:dest/
 
  # rsync -av --inplace --rsh='ssh -p1220' foldersrc root@host:dest/
 
 
 
  
 
==Contoh di http://opensource.telkomspeedy.com==
 
==Contoh di http://opensource.telkomspeedy.com==
Line 86: Line 91:
 
Coba lakukan
 
Coba lakukan
  
  # rsync rsync://opensource.telkomspeedy.com/
+
  rsync rsync://opensource.telkomspeedy.com/
  # rsync rsync://opensource.telkomspeedy.com/orari/
+
  rsync rsync://opensource.telkomspeedy.com/orari/
  # rsync rsync://opensource.telkomspeedy.com/abba/
+
  rsync rsync://opensource.telkomspeedy.com/abba/
 
 
  
 
Untuk mengcopy filenya kita dapat melakukan
 
Untuk mengcopy filenya kita dapat melakukan
  
  # rsync -ur rsync://opensource.telkomspeedy.com/orari/* /folder/data/anda
+
  rsync -ur rsync://opensource.telkomspeedy.com/orari/* /folder/data/anda
  # rsync -ur rsync://opensource.telkomspeedy.com/abba/* /folder/data/anda
+
  rsync -ur rsync://opensource.telkomspeedy.com/abba/* /folder/data/anda
 +
rsync -av --inplace --rsh='ssh -p12203' /home/library/library/* rsync://192.168.0.123/data/library/
 +
rsync -av --inplace --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* rsync://192.168.0.123/data/library/
 +
rsync -ur --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* rsync://192.168.0.123/data/library/
 +
rsync -av --inplace --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* onnowpurbo@192.168.0.123:/data/library/
  
 +
jika dibutuhkan automatic login, silahkan baca-baca [[ssh - automatic login]]
  
 
==Pranala Menarik==
 
==Pranala Menarik==
  
 
* [[Linux Howto]]
 
* [[Linux Howto]]
 +
* [[ssh]]
 +
* [[ssh - automatic login]]
  
 
[[Category: Linux]]
 
[[Category: Linux]]

Latest revision as of 08:45, 2 April 2020

Install rsync

apt-get install rsync


Server

Edit /etc/default/rsync

Agar rsync aktif dan dapat digunakan, kita perlu mengedit file,

vi /etc/default/rsync

pastikan

RSYNC_ENABLE=true

Edit /etc/rsyncd.conf

Edit

vi /etc/rsyncd.conf

Pastikan ada

pid file = /var/run/rsyncd.pid
max connections = 5
use chroot = yes
uid = nobody
gid = nogroup

Share folder

[backup]
path=/folder/tempat/backup

Buat folder backup

 # mkdir -p /folder/tempat/backup
 # chown -Rf nobody.nogroup /folder/tempat

Aktifkan rsync daemon

rsync --daemon

atau

/etc/init.d/rsync restart


Jika perlu masukan ke rc.local

# vi /etc/rc.local

isi

/usr/bin/rsync --daemon &

atau

/etc/init.d/rsync restart

Client

Untuk memudahkan proses rsync ada baiknya Mempersiapkan SSH untuk melakukan SCP Batch


Lakukan

rsync -t -v source destination


Contoh untuk Update / Achive dari komputer source

rsync -ur /home/tempat/data root@192.168.0.1:/home/backup/
rsync -ur rsync://192.168.0.1/backup/* /home/backup/


Jika kita menggunakan SSH dengan port yang tidak standard misalnya 1220 maka kita perlu mengubah sedikit perintah yang dilakukan misalnya dengan

# rsync -av --progress --inplace --rsh='ssh -p1220' foldersrc root@host:dest/

atau

# rsync -av --inplace --rsh='ssh -p1220' foldersrc root@host:dest/

Contoh di http://opensource.telkomspeedy.com

Coba lakukan

rsync rsync://opensource.telkomspeedy.com/
rsync rsync://opensource.telkomspeedy.com/orari/
rsync rsync://opensource.telkomspeedy.com/abba/

Untuk mengcopy filenya kita dapat melakukan

rsync -ur rsync://opensource.telkomspeedy.com/orari/* /folder/data/anda
rsync -ur rsync://opensource.telkomspeedy.com/abba/* /folder/data/anda
rsync -av --inplace --rsh='ssh -p12203' /home/library/library/* rsync://192.168.0.123/data/library/
rsync -av --inplace --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* rsync://192.168.0.123/data/library/
rsync -ur --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* rsync://192.168.0.123/data/library/
rsync -av --inplace --rsh='ssh -p12203 -l onnowpurbo' /home/library/library/* onnowpurbo@192.168.0.123:/data/library/

jika dibutuhkan automatic login, silahkan baca-baca ssh - automatic login

Pranala Menarik