部署rsync服务器步骤整理(CentOS 6.10)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署rsync服务器步骤整理(CentOS 6.10)相关的知识,希望对你有一定的参考价值。
部署rsync服务器步骤整理(6.10)
一、服务端配置
- 先关闭防火墙与selinux:
[[email protected] ~]# sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/selinux/config
[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce
Permissive
[[email protected] ~]# chkconfig iptables off
[[email protected] ~]# /etc/init.d/iptables stop
[[email protected] ~]# /etc/init.d/iptables status
iptables: Firewall is not running. -
安装rsync服务
[[email protected] ~]# yum install -y rsync
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile- base: mirrors.njupt.edu.cn
- extras: mirrors.aliyun.com
- updates: mirrors.aliyun.com
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
Package rsync-3.0.6-12.el6.x86_64 already installed and latest version
- 编辑rsyncd配置文件并启动服务
#created by DanChen
#Email:[email protected] blog: http://blog.51cto.com/9447803
##rsyncd.conf start##
uid = rsync #ent access username
gid = rsync #ent access group
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[backup] #rsync module
path = /backup/
ignore errors
read only = false
list = false
hosts allow = 192.168.176.0/24 #permit ip address list
#hosts deny = 0.0.0.0/32 #deny ip address list
auth users = rsync_backup #auth username
secrets file = /etc/rsyncd.password #auth password
#rsync_config___end
启动服务:rsync –daemon
查询服务运行:
[[email protected] ~]# netstat -lnutp|grep :873
tcp 0 0 0.0.0.0:873 0.0.0.0: LISTEN 1670/rsync
tcp 0 0 :::873 ::: LISTEN 1670/rsync - 创建rsync nologin用户
useradd -M -s /sbin/nologin rsync - 创建密码验证文件
-
[[email protected] ~]# echo "rsync_backup:123456" >/etc/rsyncd.password
[[email protected] ~]# cat /etc/rsyncd.password
rsync_backup:123456
chmod 600 /etc/rsyncd.password - 创建/backup文件夹并设置属主与权限
mkdir /backup –p
[[email protected] ~]# chown rsync.rsync /backup/
[[email protected] ~]# ls -ld /backup/
drwxr-xr-x. 2 rsync rsync 4096 Aug 8 22:32 /backup/
二、客户端配置
1.创建密码验证文件并设置600权限
[[email protected] ~]# echo "rsync_backup:123456" >/etc/rsyncd.password
chmod 600 /etc/rsyncd.password
- 创建/backup文件夹
mkdir /backup –p
3.查询是否安装rsync服务
[[email protected] backup]# rpm -ql rsync
安装服务yum -y install rsync*
4.测试传送文件
touch stu{1..3}
[[email protected] backup]# rsync -avz /backup/ [email protected]::backup --password-file=/etc/rsyncd.password
sending incremental file list
./
stu1
stu2
以上是关于部署rsync服务器步骤整理(CentOS 6.10)的主要内容,如果未能解决你的问题,请参考以下文章
[sersync+rsync] centos6.5 远程文件同步部署记录