CentOS5.5 install rsync

Source: Internet
Author: User
The company wants to create a group buying project and released a group buying website. I use the CentOS5.5 system, which is based on the LNMP configuration environment. Considering synchronizing data on the server, we thought of the Rsync service. Previously, Cwrsync was used in Windows. Configure the server in Linux for the first time...

The company wants to create a group buying project and released a group buying website. I use the CentOS 5.5 system, which is based on the LNMP configuration environment. Considering synchronizing data on the server, we thought of the Rsync service. Previously, Cwrsync was used in Windows. The first time I configured the service in Linux, I thought it was very simple. I found several problems in the actual operation. after several days of being depressed, the configuration was complete. As follows.
 
Server Configuration
The installation steps are as follows:
I. server configuration:
1. install xinetd and modify rsync configurations.
# Yum-y install xinetd
# Vi/etc/xinetd. d/rsync
The following code:
# Default: off
# Description: The rsync server is a good addition to an ftp server, as it \
# Allows crc checksumming etc.
Service rsync
{
Disable = yes
Socket_type = stream
Wait = no
User = root
Server =/usr/bin/rsync
Server_args = -- daemon
Log_on_failure + = USERID
}
Change disable = yes to disable = no
Restart xinetd.
#/Etc/init. d/xinetd restart
[
Note: If the server is installed with a firewall, open the port. the default port is 873.
# Telnet 127.0.0.1 873
Trying 127.0.0.1...
Telnet: connect to address 127.0.0.1: Connection refused
# Iptables-a input-s 192.168.0.0/255.255.255.0-p tcp-m tcp -- dport 873-j ACCEPT
# Iptables-a input-p tcp-m tcp -- dport 873-j DROP
]
 
2. Compile The rsync. conf configuration file.
# Vi/etc/rsyncd. conf
The content is as follows:
Port = 873
Uid = nobody
Gid = nobody
User chroot = no
Max connections = 200
Timeout = 600
Pid file =/var/run/rsyncd. pid
Lock file =/var/run/rsyncd. lock
Log file =/var/log/rsyncd. log
 
[Backup]
Path =/home/www
Ignore errors
Read only = no
List = no
# Hosts allow = 192.168.1.0/255.255.255.0
Auth users = root
Secrets file =/etc/rsyncd. secrets
 
Note:
Port # Open port
Uid = nobody # The UID of the user who backs up the data. the nobody is any user.
Gid = nobody # The GID of the backup group. The nobody is any group.
Use chroot = no # if "use chroot" is set to true, rsync first chroot to the directory specified by the path parameter before transferring files. The reason for doing so is to implement additional security protection, but the disadvantage is that the root permission is required, and the directory file pointed to by the external symbolic connection cannot be backed up. The default chroot value is true. But this is generally not required, so I choose no or false
List = no # column list not allowed
Max connections = 200 # maximum number of connections
Timeout = 600 # overwrite the IP timeout specified by the customer. that is to say, The rsync server will not always wait for a crashed client.
Pidfile =/var/run/rsyncd. pid # storage location of the pid file
Lock file =/var/run/rsync. lock # lock file storage location
Log file =/var/log/rsyncd. log # storage location of log files
 
[Backup] # Here is the authentication module name, which is the same as the samba syntax and is the name published to the outside world.
Path =/home/www # The Directory involved in synchronization
Ignore errors # ignore unrelated IO errors
Read only = no # Allow readable and writable
List = no # column list not allowed
Hosts allow = 192.168.1.0/255.255.255.0 # The syntax is the same as that of samba. only network segments of 192.168.1.0/24 can be synchronized, and all other IP addresses can be rejected.
Auth users = admin # authenticated user name
Secrets file =/etc/rsyncd. secrets # password file storage address
 
Note: Although the configuration file in this location is clearly explained, some friends may still make errors here. here I will make some highlights and make mistakes:
[Backup] is the authentication module name and path =/var/www is the directory involved in synchronization
You should remember the path here. do not simply complete it by setting it. you must know that this is the authentication module, and the data backed up from the client will be stored here in the future.
 
3. compile a user password file
# Vi/etc/rsyncd. secrets
Root: 1234789 # Username: password?
 
4. read-only permission
# Chown root: root/etc/rsyncd. secrets
# Chmod 600/etc/rsyncd. secrets
 
5. create a directory and modify the owner
# Mkdir/home/www/
# Chown-R nobody: nobody/home/www
 
6. start the service
# Rsync -- daemon
 
7. add auto-start upon startup
# Echo "rsync -- daemon">/etc/rc. local
 
2. synchronize data on the Linux client
1. the client seems to have installed rsync by default. if not, install the following:
# Yum-y install rsync
 
2. create a password file
# Vi/etc/rsyncd. passwd
The file content is as follows (only the password part is included ):
123456789
 
3. perform asynchronous synchronization:
#/Usr/bin/rsync-avz -- progress -- password-file =/etc/rsyncd. passwd root@192.168.1.1: backup/home/www
This article is from the "dream start" blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.