Rsync remote file synchronization service in Centos6.5 building


A, server-side installation
1. system environment
Server-side: centos6.5 factory environment (when the system is installed as the default setting), IP:192.168.10.185
Client: Telnet Terminal xshell5 or SecureCRT (specific installation and usage, make your own queries),
IP:192.168.10.186
2. install Rsync
Through a Terminal (here, xshell) logs on to the system 192.168.10.185
|Grep rsync*//see if the currently installed this service, if there is low and feel version, you can do
Rsync*//uninstall the modified software
Installation method:
Perform install rsync
|Grep rsync*//this statement is view information about installed software
rsync.x86_64 0:3.0.6-12.el6
Installation method two:
Official website download source package rsync: http://rsync.Samba.org/package name: rsync-3.1.1.tar.gz
Install lrzsz//at the command line, enter the RZ: upload just download the source package to the server
tar zxf rsync-3.1.1.tar.gz
cd rsync-3.1.1
./configure –prefix=/app
make
make install
Startup file location:/app/bin/rsync
3. create an rsync configuration file (default is no)
Create rsyncd.conf in/etc/(service profile)
Rsync.passwd (storing client login to rsync service user ID and password)
Rsyncd.motd (welcome or descriptive information when you log on as a service, specified, optional)
##########################################################################################
/Rsyncd.conf//create a service profile
uid = root
gid = root
Port = 873//specifies the port access, by default, 873, can also specify
Hosts allow = client//allow access to the IP address of the client
#hosts deny =
#user chroot =
#max connections =
#timeout =
[backup]
Path =/bak;//note that this directory if it does not, do not forget to create Oh!
comment = rsync files
ignore erros
read only = no
list = yes
Auth usres = rsync//validation of account, if not the anonymous synchronous, no users can also sync client synchronization.
Secrets file =/etc/rsync.passwd//certification documents
#########################################################################################
/Rsync.passwd//create a certification document
Syj:syj2015//must be in this format, rsync auth users in the account for the service profile, which they agreed on the line password.
. Readpasswd//change the file permissions for the owner only
4. firewall settings
TCP–dport ACCEPT//local access to the server, can be used to test
TCP–dport ACCEPT//client access
5. start the rsync service
/usr/bin/rsync –daemon
6. see if the service is started
[root@localhost ~]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rsync 28055 root 3u IPv4 81353 0t0 TCP *:rsync (LISTEN)
rsync 28055 root 5u IPv6 81354 0t0 TCP *:rsync (LISTEN)
This service is open
Second, the client installation
1. installation and service, do install rsync
2. start rsync, do/usr/bin/rsync–daemon
3. after the 2nd step appears Failed to parse config file:/etc/rsyncd.conf
Solution, create an empty configuration file/rsyncd.conf, and again the 2nd step
Three, instance (this server IP:192.168.10.185 client IP:192.168.10.186)
1. log on to the client and back up the contents of the/bak folder on the server to the client in the/ImageFile:
/app/bin/rsync -vzrtopg –delete –progress rsync@192.168.10.185::bak /imagefile
2. log on to the client, back up the contents of the/ImageFile folder to the client in the server/bak:
/App/bin/–delete rsync@192.168.10.185::backup–password-file=/etc/secret.pas (automatically provides password authentication)