rsync 3.1.1源码编译安装配置

来源:互联网 发布:苹果5s怎么能用4g网络 编辑:程序博客网 时间:2024/06/01 10:34
http://rsync.samba.org/rsync-3.1.1.tar.gz---0.卸载rpm# yum remove  rsync-----1.安装:tar -zxvf rsync-3.1.1.tar.gzcd rsync-3.1.1./configure --prefix=/usr/local/rsync --disable-ipv6makemake installln -s /usr/local/rsync/bin/rsync /usr/local/bin/rsync----2.server端配置# vi /usr/local/rsync/rsyncd.confpid file = /var/run/rsyncd.pidport = 873pid = rootgid = rootuse chroot = nomax connections = 200timeout 600lock file = /var/run/rsyncd.locklog file = /var/run/rsyncd.logsecrets file = /usr/local/rsync/rsyncd.secrets motd file = /etc/rsyncd.motd[test]path = /test/ignore errorsread only = truelist = falsehosts allow = *#hosts deny = 0.0.0.0/32auth users root  #该用户系统中存在且对后面指定的备份目录拥有权限comment = ocpyang  test    #vi /usr/local/rsync/rsyncd.motd++++++++++++++++++++++++++++++++++++Wlecome to ocpyang  rsync services       ++++++++++++++++++++++++++++++++++++--指定rsync访问的密码,密码不需要和系统账号密码相同# vi /usr/local/rsync/rsyncd.secrets  root:snow01ln -s /usr/local/rsync/rsyncd.conf /etc/rsyncd.confln -s /usr/local/rsync/rsyncd.motd /etc/rsyncd.motdln -s /usr/local/rsync/rsyncd.secrets  /etc/rsyncd.secretschmod 600 /usr/local/rsync/rsyncd.secretschown root:root /usr/local/rsync/rsyncd.secrets启动rsync# /usr/bin/rsync --daemon --config=/etc/rsyncd.conf# echo "/usr/bin/rsync --daemon --config=/etc/rsyncd.conf" >> /etc/rc.d/rc.local# cat /etc/rc.d/rc.local #!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/usr/bin/rsync --daemon# netstat -lntp | grep 873tcp        0      0 0.0.0.0:873                 0.0.0.0:*                   LISTEN      10689/rsync        tcp        0      0 :::873                      :::*                        LISTEN      10689/rsync  --新建测试文件#dd if=/dev/zero of=/test/t01.file bs=1M count=50#pkill rsync----3.客户端服务器配置(1).新建客户端密码文件(客户端不带用户名)#vi /etc/rsyncd.secretssnow01#chmod 600 /etc/rsyncd.secretsrsync -vzrtopg  --progress --delete  root@192.168.5.189::test /ocpyang/ rsync -vzrtopg --progress --delete  root@192.168.5.189::test /ocpyang/ --password-file=/etc/rsyncd.pwd(3).新建同步脚本# vi /rsync.sh#!/bin/bash  rsync -vzrtopg  --progress --delete  root@192.168.5.189::test /testbak/ rsync -vzrtopg --progress --delete  root@192.168.5.189::test /testbak/ --password-file=/etc/rsyncd.pwd(4).手动同步文件#cd /#./rsync.sh(5).自动同步:每隔五分钟同步一次# crontab -e0,5 * * * * /rsync.sh


0 0
原创粉丝点击