[[email protected] home]# rpm -qa |grep rsync #查抄系統(tǒng)是否安裝了rsync軟件包
rsync-2.6.8-3.1[[email protected] CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm # 假如沒(méi)有安裝則手動(dòng)安裝
[[email protected] rsync-3.0.4]# vim /etc/xinetd.d/rsync
1 設(shè)置rsync servervi /etc/xinetd.d/rsync
將disable=yes改為no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2 設(shè)置rsync自動(dòng)啟動(dòng)
[[email protected] etc]# chkconfig rsync on
[[email protected] etc]# chkconfig rsync --list
rsync on
3 設(shè)置rsyncd.conf
[[email protected] etc]# vim rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /srv
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
4 確保etc/services中rsync端標(biāo)語(yǔ)正確
[[email protected] etc]# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5
設(shè)置rsync暗碼(在上邊的設(shè)置文件中已經(jīng)寫(xiě)好路徑)/home/rsync.ps(名字隨便寫(xiě),只要和上邊設(shè)置文件里的一致即可),名目(一行一個(gè)用戶(hù))
[[email protected] etc]# vi /home/rsync.ps
scihoo:scihoo
6 設(shè)置rsync暗碼文件權(quán)限
[[email protected] home]# chown root.root rsync.ps
[[email protected] home]# chmod 400 rsync.ps
7 啟動(dòng)設(shè)置
[[email protected] home]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 假如xinetd沒(méi)有的話(huà),,需要安裝一下
[[email protected] home]# yum -y install xinetd
啟動(dòng)rsync server
RSYNC處事端啟動(dòng)的兩種要領(lǐng)
9、啟動(dòng)rsync處事端(獨(dú)立啟動(dòng))
[[email protected] home]# /usr/bin/rsync --daemon
10、啟動(dòng)rsync處事端 (有xinetd超等歷程啟動(dòng))
[[email protected] home]# /etc/init.d/xinetd reload
11 插手rc.local
在各類(lèi)操縱系統(tǒng)中,rc文件存放位置不盡溝通,可以修改使系統(tǒng)啟動(dòng)時(shí)把rsync --daemon加載進(jìn)去。
[[email protected] home]# vi /etc/rc.local
/usr/local/rsync –daemon #插手一行
12 查抄rsync是否啟動(dòng)
[[email protected] home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync (LISTEN)
客戶(hù)端設(shè)置
1 設(shè)置三個(gè)進(jìn)程就可以了
1.1 設(shè)定暗碼文件
1.2 測(cè)試rsync執(zhí)行指令
1.3 將rsync指令放入事情排程(crontab)
[[email protected] home]# vi /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp
server, as it
# allows crc checksumming etc.
service rsync
{
disable = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.1 設(shè)置暗碼文件 (注:為了安詳,設(shè)定暗碼檔案的屬性為:600。rsync.ps的暗碼必然要和Rsync
Server暗碼設(shè)定案里的暗碼一樣)
[[email protected] home]# vi rsync.ps
sciooo
[[email protected] home]# chown root.root .rsync.ps # 留意必需給權(quán)限
[[email protected] home]# chmod 600 .rsync.ps # 必需修改權(quán)限
1.2 從處事器上下載文件
[[email protected] rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps
[email protected]::backup /home/
從當(dāng)?shù)厣蟼麟S處事器上去
[[email protected] rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps
/home [email protected]::backup