首页 > 系统 > CentOS > 正文

Centos6.6 安装rsync服务端

2024-06-28 13:20:00
字体:
来源:转载
供稿:网友
Centos6.6 安装rsync服务端

一、介绍

  在工作中经常遇到代码分发,或者是资料备份,都会用到rsync,配置不算复杂,仅做下记录,安装环境如下:

  1) Centos6.6

  2)rsync-3.0.6-12.el6.x86_64

  3) Server ip:192.168.19.128;Client IP:192.168.19.145

二、安装

  

$ yum install -y rsync xinetd$ setenforce 0  或者  echo "SElinux=disabled" >/etc/selinux/config (需要重启才能生效)

二、配置

  

$ vi /etc/rsyncd.confuid=root                                    #以指定的 UID 传输文件gid=root                                    #以指定的 GID 传输文件#hosts allow=10.50.53.100                   #允许指定主机访问#hosts deny=0.0.0.0/32                      #阻止指定主机访问use chroot=yes                              max connections=10                          #允许的最大连接数pid file=/var/run/rsyncd.pid                #指定pid文件路径lock file=/var/run/rsync.lock               #指定进程锁文件log file=/var/log/rsyncd.log                #指定日志路径timeout=600                                 #连接超时时间port=873                                    #指定tcp端口[backup]path=/datacomment=rsync filesread only=nolist=yesauth users=chicken00secrets file=/etc/.rsyncd.secrets
#设置用户和密码,用户跟配置文件指定相同(auth users)
$ echo "chicken00:chicken00" >/etc/.rsyncd.secrets#必须设定文件的权限600$ chmod 600 /etc/.rsyncd.secrets

三、启动

  

#设为开机启动$ chkconfig rsync on#查看开机启动$ chkconfig --list rsync    rsync              on#rsync 守护进程管理工具xinetd配置中的内容$ cat /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    = noflags    = IPv6socket_type = streamwait = nouser = rootserver = /usr/bin/rsyncserver_args = --daemonlog_on_failure += USERID}#启动服务$ /etc/init.d/xinetd start

四、检查

#开启防火墙

五、客户端同步测试

$ echo "chicken00" >/etc/.rsyncd.secrets$ chmod 600 /etc/.rsyncd.secrets$ echo 'hello rsync!!' >hello.txt#上传文件$ rsync -vzrtopg --delete --PRogress hello.txt chicken00@192.168.19.128::backup --passWord-file=/etc/.rsyncd.secrets

#在服务端看看文件是否同步过来了

#下载$ rsync -vzrtopg --delete --progress chicken00@192.168.19.128::backup $(pwd)/backup-$(date +%Y-%m-%d) --password-file=/etc/.rsyncd.secrets


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表