首先我的服务器端ip:192.168.122.129
客户端IP: 192.168.122.111
1.先来配置服务器端:
确认是否安装rsync
# rpm -qa |grep rsync
如果没有安装可以从光盘上安装如下:
1. 挂载光盘:
Mkdir /mnt/cdrom
Mount /dev/hdc /mnt/cdrom
Cd Server
rpm -ivh rsync-2.5.6-20.i386.rpm
umount /mnt/cdrom
eject
2. 配置rsync
在 /etc/xinetd.d/rsync
将disable=yes改为no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
3.配置rsync自启动
[root@ etc]#chkconfig rsync on
[root@ etc]# chkconfig rsync --list
rsync on
4.自己配置rsyncd.conf
uid= root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
hosts allow = 192.168.122.111
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup] #你要备份的
path = /srv #实际目录
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
5./etc/services 里面添加873端口
rsync873/tcp # rsync
rsync 873/udp # rsync
6.. 配置rsync密码(在上边的配置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边配置文件里的一致即可),格式
(一行一个用户)
[root@ etc]# vi /home/rsync.ps
root:123456
7. 配置rsync密码文件权限,进入home目录
[root@ home]# chown root.root rsync.ps
[root@ home]# chmod 700 rsync.ps
8 启动
启动rsync服务
[root@ home]# /usr/bin/rsync –daemon
9. 加入rc.local
在各种操作系统中,rc文件存放位置不尽相同,可以修改使系统启动时把rsync --daemon加载进去。
[root@ home]# vi /etc/rc.local
/usr/local/rsync –daemon #加入一行
9检查rsync是否启动
[root@ home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync(LISTEN)
启动成功 服务器端完成