RockyLinux下Rsync Server安裝和配置

rsync簡介

rsync是一款快速的,開源的,多功能的,可以實現全量和增量的遠程和本地的數據同步和數據備份的工具。

二、安裝

1.查看是否安裝

rpm -qa | grep rsync

2.安裝

dnf install -y rsync

3.配置rsync服務端的配置文件

3.1 rsyncd.conf
vim /etc/rsyncd.conf
uid = root
gid = root
port = 9600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = *
read only    = true
use chroot = false
strict modes = false

[image]    
path = /var/www/test
transfer logging = yes
auth users = gb
secrets file = /var/www/rsyncConf/auth.passwd
3.2 auth.passwd格式
gb:123456
3.3 設置auth.passwd權限600
chmod -c 600 auth.passwd

三、用systemctl管理rsync服務

1.創建一個配置文件

vim /etc/sysconfig/rsyncd
OPTIONS=""

2.創建service文件

vim /lib/systemd/system/rsyncd.service
[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"

[Install]
WantedBy=multi-user.target

3.加入開啓啓動項

systemctl enable rsyncd

4. 啓動

systemctl start rsyncd
systemctl status rsyncd

四、rsync客戶端同步

 rsync.exe -avzP --progress --delete --port=9600 --password-file=/cygdrive/d/auth.passwd  [email protected]::image /cygdrive/d/test_rsync 
 

參考鏈接:centos8環境安裝配置rsync - 劉宏締的架構森林 - 博客園 (cnblogs.com)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章