[[email protected] home]# rpm -qa |grep rsync #查抄系统是否安装了rsync软件包
rsync-2.6.8-3.1[[email protected] CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm # 假如没有安装则手动安装
[[email protected] rsync-3.0.4]# vim /etc/xinetd.d/rsync
1 设置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 设置rsync自动启动
[[email protected] etc]# chkconfig rsync on
[[email protected] etc]# chkconfig rsync --list
rsync on
3 设置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端标语正确
[[email protected] etc]# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5
设置rsync暗码(在上边的设置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边设置文件里的一致即可),名目(一行一个用户)
[[email protected] etc]# vi /home/rsync.ps
scihoo:scihoo
6 设置rsync暗码文件权限
[[email protected] home]# chown root.root rsync.ps
[[email protected] home]# chmod 400 rsync.ps
7 启动设置
[[email protected] home]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 假如xinetd没有的话,,需要安装一下
[[email protected] home]# yum -y install xinetd
启动rsync server
RSYNC处事端启动的两种要领
9、启动rsync处事端(独立启动)
[[email protected] home]# /usr/bin/rsync --daemon
10、启动rsync处事端 (有xinetd超等历程启动)
[[email protected] home]# /etc/init.d/xinetd reload
11 插手rc.local
在各类操纵系统中,rc文件存放位置不尽沟通,可以修改使系统启动时把rsync --daemon加载进去。
[[email protected] home]# vi /etc/rc.local
/usr/local/rsync –daemon #插手一行
12 查抄rsync是否启动
[[email protected] home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync (LISTEN)
客户端设置
1 设置三个进程就可以了
1.1 设定暗码文件
1.2 测试rsync执行指令
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 设置暗码文件 (注:为了安详,设定暗码档案的属性为:600。rsync.ps的暗码必然要和Rsync
Server暗码设定案里的暗码一样)
[[email protected] home]# vi rsync.ps
sciooo
[[email protected] home]# chown root.root .rsync.ps # 留意必需给权限
[[email protected] home]# chmod 600 .rsync.ps # 必需修改权限
1.2 从处事器上下载文件
[[email protected] rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps
[email protected]::backup /home/
从当地上传随处事器上去
[[email protected] rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps
/home [email protected]::backup