centos6.4x64最小化安装部署rsync

一、环境

系统:CentOS6.4x64最小化安装

rsync-1:192.168.3.50

rsync-2:192.168.3.52

二、安装rsync

卸载原有的rsync软件包

[[email protected] ~]# rpm -e `rpm -qa |grep rsync`

下载最新的rsync安装包,并安装

[[email protected] ~]# wget http://pkgs.repoforge.org/rsync/rsync-3.1.1-1.el6.rfx.x86_64.rpm
[[email protected] ~]# rpm -ivh rsync-3.1.1-1.el6.rfx.x86_64.rpm 
warning: rsync-3.1.1-1.el6.rfx.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing...                ########################################### [100%]
   1:rsync                  ########################################### [100%]

场景:从rsync-1直接推送文件到rsync-2的/root目录下

#查看rsync-2的/root目录下的文件
[[email protected] ~]# ll /root/
total 56
-rw-------. 1 root root  2790 May  4 13:49 anaconda-ks.cfg
-rw-r--r--. 1 root root  3305 May  4 13:49 cobbler.ks
-rw-r--r--. 1 root root 20504 May  4 13:49 install.log
-rw-r--r--. 1 root root  5882 May  4 13:48 install.log.syslog
-rw-r--r--. 1 root root  2241 May  4 13:49 ks-post.log
-rw-r--r--. 1 root root     1 May  4 13:49 ks-post-nochroot.log
-rw-r--r--. 1 root root   978 May  4 13:45 ks-pre.log

#在rsync-1上直接推送文件到rsync-2上
[[email protected] ~]# rsync -avz rsync-3.1.1-1.el6.rfx.x86_64.rpm 192.168.3.52:/root
[email protected]‘s password: 
sending incremental file list
rsync-3.1.1-1.el6.rfx.x86_64.rpm

sent 409,478 bytes  received 35 bytes  117,003.71 bytes/sec
total size is 413,760  speedup is 1.01

#在rsync-2上查看结果
[[email protected] ~]# ll /root/
total 464
-rw-------. 1 root root   2790 May  4 13:49 anaconda-ks.cfg
-rw-r--r--. 1 root root   3305 May  4 13:49 cobbler.ks
-rw-r--r--. 1 root root  20504 May  4 13:49 install.log
-rw-r--r--. 1 root root   5882 May  4 13:48 install.log.syslog
-rw-r--r--. 1 root root   2241 May  4 13:49 ks-post.log
-rw-r--r--. 1 root root      1 May  4 13:49 ks-post-nochroot.log
-rw-r--r--. 1 root root    978 May  4 13:45 ks-pre.log
-rw-r--r--  1 root root 413760 Jun 23  2014 rsync-3.1.1-1.el6.rfx.x86_64.rpm

三、配置rsync服务

配置rsync已xinetd方式运行

[[email protected] ~]# yum install xinetd -y

#修改/etc/xinetd.d/rsync 
[[email protected] ~]# vim /etc/xinetd.d/rsync 
service rsync
{
    disable         = no          ##将yes改成no  
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/rsync
    server_args     = --daemon
    log_on_failure  += USERID
}
#启动xinetd服务
[[email protected] ~]# service xinetd start
Starting xinetd:                                           [  OK  ]

#rsync默认的监听端口是873,查看873号端口是否启动
[[email protected] ~]# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1244/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1321/master         
tcp        0     52 192.168.3.50:22             192.168.3.2:17985           ESTABLISHED 1812/sshd           
tcp        0      0 :::22                       :::*                        LISTEN      1244/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1321/master         
tcp        0      0 :::873                      :::*                        LISTEN      1957/xinetd

添加防火墙规则,放行873端口

[[email protected] ~]# iptables -I INPUT -p tcp --dport 873 -j ACCEPT
[[email protected] ~]# iptables -I INPUT -p udp --dport 873 -j ACCEPT
[[email protected] ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[[email protected] ~]# iptables -L -n |grep 873
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:873 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:873

创建rsync服务目录和配置文件

#创建rsync服务目录
[[email protected] ~]# mkdir /etc/rsyncd   
# 创建配置文件
[[email protected] ~]# touch /etc/rsyncd/rsyncd.conf
# 创建密码文件
[[email protected] ~]# touch /etc/rsyncd/rsyncd.secrets
#权限修改
[[email protected] ~]# chown root:root /etc/rsyncd/rsyncd.passwd
[[email protected] ~]# chmod 600 /etc/rsyncd/rsyncd.secrets

创建用户和密码

[[email protected] ~]# echo "rsync:test" >>/etc/rsyncd/rsyncd.secrets

创建rsync配置文件

[[email protected] ~]# vim /etc/rsyncd/rsyncd.conf
# GLOBAL OPTIONS
uid = root
gid = root

use chroot = no

read only = yes

#limit access to private LANs
hosts allow=192.168.3.0/255.255.0.0
hosts deny=*
max connections = 5

pid file = /var/run/rsyncd.pid

secrets file = /etc/rsyncd/rsyncd.secrets
#lock file = /var/run/rsync.lock           

motd file = /etc/rsyncd/rsyncd.motd        

#This will give you a separate log file
log file = /var/log/rsync.log               

#This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes

log format = %t %a %m %f %b
syslog facility = local3
timeout = 300

# MODULE OPTIONS
[test]
path = /data/test
list=yes
ignore errors
auth users = rsync
comment = welcome to rsync server

编辑xinetd的rsync配置文件,添加配置文件路径

#添加rsync的配置文件路径
[[email protected] ~]# vim /etc/xinetd.d/rsync
service rsync
{
    disable = no
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/rsync
    server_args     = --daemon --config=/etc/rsyncd/rsyncd.conf    #添加配置文件路径
    log_on_failure  += USERID
}
[[email protected] ~]# service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[[email protected] ~]# netstat -anpt |grep 873
tcp        0      0 :::873                      :::*                        LISTEN      2045/xinetd

在客户端rsync-2上查看rsync-1提供了哪些数据服务

[[email protected] ~]# rsync --list-only [email protected]::
test           	welcome to rsync server
#现已有一个名为test的数据服务
#将test同步到本地的/root目录下
时间: 2024-08-07 02:41:07

centos6.4x64最小化安装部署rsync的相关文章

【Linux】CentOS6.X最小化安装后配置

1.centos6.5最小化安装后启动网卡2.ifconfig查询IP进行SSH链接3.更新系统源并且升级系统4.系统时间更新和设定定时任5.修改ip地址.网关.主机名.DNS6.关闭selinux,清空iptables7.创建普通用户并进行sudo授权管理8.修改SSH端口号和屏蔽root账号远程登陆9.锁定关键文件系统(禁止非授权用户获得权限)10.精简开机自启动服务11.调整系统文件描述符大小12.设置系统字符集13.清理登陆的时候显示的系统及内核版本14.内核参数优化15.定时清理/va

centos6.x最小化安装后配置网络

centos6.x最小化安装后配置网络 最小化安装CentOS6.x后,试着用yum安装几个软件,发现网卡都没配置! 解决办法: 编辑配置文件: vi /etc/sysconfig/network-script/ifcfg-eth0 修改下列几项配置: NM_CONTROLLED=no ONBOOT=yes BOOTPROTO=dhcp 修改完保存,然后: service network start 启动网卡,yum能用了!

centos6.4 最小化安装的一些配置

当我选择centos最小化安装时,发现好多命令都用不了,比如scp,ssh等 发现setup也不行 现在开始安装setup 最小化装完centos 6.4系统后,发现用setup的配置命令没有了.这时就要手动去安装这个快速配置程序了. # yum install setuptool ssh命令安装 yum install open***-clients http://bbs.myhack58.com/read.php?tid-612903-page-e-fpage-13.html http://

Centos6.4最小化安装后使用xfce桌面环境

由于我个人使用的Centos是在虚拟机中最小化安装的,gnome实在是不喜欢,所以自己装了个xfce,安装后启动不起来,才发现x window等依赖环境没装,为了少走弯路,在此写下安装过程. 1.yum源配置过程 $ wget http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm $ sudo rpm -ivh epel-release-6-5.noarch.rpm $ sudo yum s

centos6.8最小化安装后优化脚本

#!/bin/sh #优化1 开机启动网卡 cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<EOF DEVICE=eth0 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=192.168.122.147 NETMASK=255.255.255.0 GATEWAY=192.168.122.1 DNS1=192.168.122.1 DNS2=114.114.114.114 EOF #优化2 更改

centos6.5最小化安装之后装图形化界面

查看自己系统环境 # cat /etc/issue 先要安装KDE桌面环境,执行命令: # yum groupinstall "X Window System" "KDE Desktop" Desktop -y 同时安装了 3 个软件包.注意,因为 KDE Desktop 和 X Window System 两个软件包名称中间都包含空格,需要用引号引起来才行. 然后安装Gnone桌面环境,执行命令: # yum groupinstall "X Window

centos6.5 最小化安装FTP虚拟账号配置

客户机:192.168.0.106 服务端:192.168.0.108(xiaohua108) 一.安装vsftp软件 1.服务端安装直接使用yum安装yum -y install vsftpd 2.客户端安装yum -y install lftp 二.创建虚拟账号 1.创建用户文本文件,添加用户,格式为一行用户一行密码 [[email protected] ~]# vim /etc/vsftpd/vsftpd_user.txt 此文件需要创建 xiaohua  #用户名 此用户名需要与下文创建

centos6.x最小化安装后使用图形界面的方法

在个人测试的时候,有时候需要图形界面,但已经安装了minimal,此时又想使用图形界面的解决办法: 1.安装桌面安装包 #yum -y groupinstall "X Window System" #yum -y groupinstall "GNOME Desktop" 2.配置inittab实现开机启动到桌面 修改如下配置:5代表开机到图形界面,3表示开机到纯命令行界面 #vim /etc/inittab id:5:initdefault: 或者用init 5 -

基于最小化CENTOS6.6最小化安装,oracle 11g 数据安装过程!

Linux环境配置 OS:CentOS 6.6 DB:Oracle 11gR2 将Oracle安装到home/oracle目录 配置过程:本文来自Oracle官方文档+网上资料 Oracle官方文档:http://www.oracle.com/pls/db112/homepage 1. 以root用户登录到Linux 2. 检查机器硬件要求 2.1 内存要求 至少需要1GB的内存  查看机器内存大小  # grep MemTotal /proc/meminfoswap 空间调整swapoff -