1.下载安装包

cd /data/soft
wget https://download.samba.org/pub/rsync/src/rsync-3.3.0.tar.gz

2.编译安装rsync

yum install -y maka gcc openssl-devel libzstd-devel lz4-devel
tar -xf rsync-3.3.0.tar.gz
./rsync-3.3.0/configure --prefix=/data/rsync --disable-ipv6 --disable-xxhash
make
make install

3.创建软连接

ln -s /data/rsync/bin/rsync /bin/rsync

4.创建配置文件

vim /data/rsync/rsyncd.conf
uid = root
gid = root
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
list = false
auth users = rsync_backup
pid file = /data/rsync/run/rsync.pid
log file = /data/rsync/run/rsync.log
lock file = /data/rsync/run/rsync.locck

5.启动服务

rsync --daemon --config=/data/rsync/rsyncd.conf

6.Windows下载客户端

https://itefix.net/dl/free-software/cwrsync_6.3.0_x64_free.zip
Windows客户端配置注意事项
1.需要配置cwrsync的path环境,如果本地path已配置过openssh,需要将cwrsync位置放在openssh前边
2.Windows本地路径需要按照固定规则设置,如下:
Windows路径为: "C:\Users\test\Desktop\R-C.jpg"
转换后的路径为:/cygdrive/C/Users/test/Desktop/R-C.jpg

7.文件传输

上传文件
rsync -e "ssh -p 2222" -avz /cygdrive/C/Users/test/Desktop/R-C.jpg root@oaroad.com:/data/backup/wrapp
下载文件
rsync -e "ssh -p 2222" root@oaroad.com:/root/get-pip.py /cygdrive/C/Users/test/Desktop/