Server configuration and installation
Server
Step one: Download the rsync installation package (online installation or Offline installation)
. =/usr/local/rsyncd
make && make install )
/*I am still directly/etc (convenient to find)*/
Touch /etc/rsyncd.conf
Touch /etc/rsyncd.secrets ## Touch /etc/rsyncd.motd
You can also use vim to create it
.secrets must be given chmod 600 permissions, otherwise an error will be reported */
Step 3: Start the server
rsync --daemon -- config=/etc/rsyncd.conf
or
/usr/local/rsyncd/bin/rsync --daemon --config=/etc/rsyncd.conf
Step 4: Let the firewall pass the rsync port (do not block port 873)
iptables -I INPUT -p tcp --dport 873 -j ACCEPT /*Let the firewall open port 873 ( Otherwise it will intercept and fail to start)*/ . # target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:rsync
##
Client configuration installation
Client
Step 1: Download RSYNC installation package (online installation or offline installation)
completely
Tar-XZF RSYNC-3.2.TAR.GZ CD RSYNC-3.1.2 ./configure --prefix=/usr/local/rsyncd make && make install
Step 2: Start the client
rsync --daemon
Or
/usr/local/rsyncd/bin/rsync --daemon
Step 3: Let the firewall pass the rsync port (do not block port 873)
iptables -I INPUT -p tcp --dport 873 -j ACCEPT
/*Execute the command: iptables ’ to ’ s ’ s ’ s ’ to rsync ’ to rsync DestInation
Accept TCP -Anywhere Anywhere TCP DPT: RSYNC
:: See what available data sources are available on the RSYNC server (see if you can ping)
rsync --list-only root@192.168.145.129::
rsyncd.secrets
root:lizhenghua
rsyncd.motd
********************************************************** ◢◣ ◢◣ ◢■■◣ ◢■■◣ ◢■■■■■■■■■◣ ◥■■■■■■■■■◤ ◥■■■■■■■◤ ◥■■■■■◤ ◥■■■◤ ◥■◤ ▼ Welcome to the rsync world! \ \ \ \ \ \ \ \ ● 》》 《 _▂▃▄▅▆▇███▇▆▅▄▃ ***********************************************************
rsyncd.conf
#主核心 uid = 0 #守护进程所属的uid,默认是nobody gid = 0 #守护进程所属的uid,默认是nobody max connections = 4 #客户端最多连接数 read only = false #是否只读操作 hosts allow = 192.168.145.128 #允许访问的IP,可以指定单个IP,也可以指定整个网段,能提高安全性。 hosts allow = * #允许所有ip访问 transfer logging = true #记录传输文件的日志 log format = %h %o %f %l %b #日志格式 log file = /var/log/rsyncd.log #rsync 服务器的日志 slp refresh = 300 #定时刷新 pid file = /var/run/rsyncd.pid #pid存放日志 lock file = /var/run/rsyncd.lock #lock日志文件 motd file = /etc/rsyncd.motd #欢迎界面 #模块 [web] #模块名字 path = /home/admin/public_html #模块路径 comment = Mirror to Hk server #模块注释 read only = false #是否只读 list = true #是否显示列表 auth users = root #用户 secrets file = /etc/rsyncd.secrets #验证的密码文件 [test] #模块名字 path = /home/admin/domains/test #模块路径 read only = false #是否只读 auth users = root #用户 list = true #是否显示列表 exclude = oracle/ #不需要同步的文件夹 secrets file = /etc/rsyncd.secrets #验证的密码文件 [king] #如上所示 path = /home comment = connect to the /home read only = false list = true auth users root secrets file = /etc/rsyncd.secrets
uid = root gid = root max connections = 4 read only = true hosts allow = 192.168.145.128 hosts allow = * transfer logging = true log format = %h %o %f %l %b log file = /var/log/rsyncd.log slp refresh = 300 log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.lock motd file = /etc/rsyncd.motd [web] path = /home/web/ list = true read only = false auth users = root secrets file = /etc/rsyncd.secrets [test] path = /home/test/ list = true read only = false auth users = root secrets file = /etc/rsyncd.secrets [king] path = /home/ list = true read only = false auth users = root secrets file = /etc/rsyncd.secrets
The above is the detailed content of Configuring and installing rsync tutorial. For more information, please follow other related articles on the PHP Chinese website!