Install rsync on centos
Install rsync software first
Install yum
Yum install rsync,
Compile and install
Visit http://rsync.samba.org/to download the latest rsyncstable version.
Wget http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz
Wget http://rsync.samba.org/ftp/rsync/src/rsync-patches-3.0.9.tar.gz
Tar-zxvf rsync-3.0.9.tar.gz
Tar-zxvf rsync-patches-3.0.9.tar.gz
Cd rsync-3.0.9
./Configure
Make
Make install
Installation Complete
Then configure rsync
The rsync service requires three files.
Rsyncd. conf rsync service configuration file
The rsyncd. secrets rsync service user password file must be an existing user on the server
Rsyncd. motd rsync service logon prompt information
To ensure password security, you must change the rsyncd. secrets permission to 600 chmod 0600 rsyncd. secrets.
By default, the mkdir-p/etc/rsyncd files do not exist.
Touch rsyncd. conf
Touch rsyncd. secrets
Touch rsyncd. motd
Add configuration file content:
Vim/etc/rsyncd. conf
Pid file =/var/run/rsyncd. pid rsync service pid file storage location
Port = 873 port number
Address = 192.168.1.2 address of the rsync Service
Uid = root user
Gid = root user group
Usechroot = yes chroot settings
Read only = no read-only
Hosts allow = ip addresses allowed to access 192.168.1.0/24
Hosts deny = * ip address for Access prohibited
Max connections = 5 max connections
Motd file =/etc/rsyncd. motd: Specifies the location of the information file.
Log file =/var/log/rsyncd. log location of the log file
Log format = % t % a % m % f % B log File format
Syslog facility = local3
Timeout = 300 connection timeout
Secrets file =/etc/rsyncd. secrets Password file
[Backup]
Path =/test
Auth users = root
Lsit = true
Ignore errors
Secrets file =/etc/rsyncd. secrets
Specify a password for rsync users
Vim/etc/rsyncd. secrets
Root: 111111
Start rsync
/Usr/local/rsync -- daemon -- config =/etc/rsyncd. conf
Client Configuration
Install rsync
Rsync -- list-only root@192.168.1.2: backup View File Information in the backup directory set by rsync
Synchronize files
Rsync-azuvP root@192.168.1.2: backup/backup
Rsync-azu -- password-file =/etc/rsyncd. password root@192.168.1.2: backup/backup
Vim/etc/rsyncd. password
111111
Chmod 0600/etc/rsyncd. password
If you want to periodically Execute
Crontab-e
20 00 *** rsync-azu -- password-file =/etc/rsyncd. password root@192.168.1.2: backup/backup>/dev/null 2> & 1