通过 rsync 搭建 CentOS 本地 yum 源服务器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过 rsync 搭建 CentOS 本地 yum 源服务器相关的知识,希望对你有一定的参考价值。

说明:

操作系统:CentOS 6.x

主机名:yum.base.com

IP 地址:192.168.27.233(生产区服务器)

实现目的:由于生产区服务器无法上外网,为了方便生产区安装软件,同步 yum 镜像站点的内容到此服务器,向生产区提供 yum服务。

RSYNC 代理上网:

[[email protected] ~]# vim /etc/profile

export RSYNC_PROXY="repo.base.com:3128"

[[email protected] ~]# source /etc/profile

准备篇:

一、安装 HTTP 服务

这里使用 nginx 提供 HTTP 服务。

NGINX 的安装

[[email protected] ~]# cd /opt/nginx-1.12.1

[[email protected] nginx-1.12.1]# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre

[[email protected] nginx-1.12.1]# make

[[email protected] nginx-1.12.1]# make install

 二、系统约定

NGINX 系统根目录:/opt/yum_data/

三、开启 NGINX 目录浏览功能

[[email protected] conf]# vim nginx.conf
user root;
server {
listen 80;
server_name yum.base.bjebc.com;
#charset koi8-r;
#access_log logs/host.access.log main;
root /opt/yum_data;
location / {
autoindex on;                                                    #<--开启 nginx 目录浏览功能
autoindex_exact_size off;                                        #<--文件大小从 KB 开始显示
autoindex_localtime on;                                          #<--显示文件修改时间为服务器本地时间
   }
}
[[email protected] ~]# cd /usr/local/nginx/sbin/
[[email protected] sbin]# nginx

安装篇:

一、创建镜像文件存放目录

[[email protected] ~]# mkdir /opt/yum_data/centos/6/{extras,os,updates}/x86_64 -p
[[email protected] ~]# mkdir /opt/yum_data/epel/{6,7}/x86_64/ -p
[[email protected] ~]# mkdir /opt/yum_data/repoforge/rhel/el{6,7}/en/x86_64/{extras,rpmforge}/RPMS/ -p
[[email protected] ~]# mkdir /opt/yum_data/remi/6/remi/x86_64/ -p
[[email protected] ~]# mkdir /opt/yum_data/elasticstack/elastic-{5.x,6.x}/ -p
[[email protected] ~]# mkdir /opt/yum_data/foreman/{plugins,releases}/1.12/el6/x86_64/ -p
[[email protected] ~]# mkdir /opt/yum_data/nginx/{6,7}/x86_64/RPMS/ -p
[[email protected] ~]# mkdir /opt/yum_data/zabbix/ -p
[[email protected] ~]# mkdir /opt/yum_data/puppet/el/6/{dependencies,devel,products}/{i386,x86_64} -p
[[email protected] opt]# tree -L 3 yum_data/centos/
yum_data/centos/
└── 6
    ├── extras
    │   └── x86_64
    ├── os
    │   └── x86_64
    └── updates
        └── x86_64
7 directories, 0 files
[[email protected] opt]# tree -L 3 yum_data/epel/
yum_data/epel/
├── 6
│   └── x86_64
│       ├── drpms
│       ├── epel-release-6-8.noarch.rpm
│       ├── Packages
│       └── repodata
└── 7
    └── x86_64
        ├── drpms
        ├── Packages
        └── repodata
10 directories, 1 file
[[email protected] opt]# tree -L 3 yum_data/remi/
yum_data/remi/
└── 6
    ├── foo
    ├── php54
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── php55
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── php56
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── php70
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── php71
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── php72
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── remi
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    ├── safe
    │   ├── httpsmirror
    │   ├── mirror
    │   └── x86_64
    └── x86_64
        ├── foo
        ├── php54
        ├── php55
        ├── php56
        ├── php70
        ├── php71
        ├── php72
        ├── remi
        └── safe
26 directories, 18 files
[[email protected] opt]# tree -L 4 yum_data/repoforge/
yum_data/repoforge/
└── rhel
    ├── el6
    │   └── en
    │       └── x86_64
    └── el7
        └── en
            └── x86_64
7 directories, 0 files
[[email protected] opt]# tree -L 3 yum_data/nginx/
yum_data/nginx/
├── 6
│   └── x86_64
│       ├── repodata
│       └── RPMS
└── 7
    └── x86_64
        ├── repodata
        └── RPMS
[[email protected] opt]# tree -L 4 yum_data/foreman/
yum_data/foreman/
├── plugins
│   └── 1.12
│       └── el6
│           └── x86_64
└── releases
    └── 1.12
        └── el6
            └── x86_64
8 directories, 0 files
[[email protected] opt]# tree -L 2 yum_data/zabbix/
yum_data/zabbix/
├── non-supported
│   └── rhel
├── RPM-GPG-KEY-ZABBIX -> RPM-GPG-KEY-ZABBIX-79EA5ED4
├── RPM-GPG-KEY-ZABBIX-79EA5ED4
├── RPM-GPG-KEY-ZABBIX-A14FE591
├── RPM-GPG-KEY-ZABBIX-A14FE591-EL5
├── zabbix
│   ├── 1.8
│   ├── 2.0
│   ├── 2.2
│   ├── 2.4
│   ├── 2.5
│   ├── 3.0
│   ├── 3.1
│   ├── 3.2
│   ├── 3.4
│   └── 3.5
└── zabbix-official-repo.key
13 directories, 5 files
[[email protected] opt]# tree -L 2 yum_data/elasticstack/
yum_data/elasticstack/
├── elastic-5.x
│   ├── 5.0.0
│   ├── 5.0.1
│   ├── 5.0.2
│   ├── 5.1.1
│   ├── 5.1.2
│   ├── 5.2.0
│   ├── 5.2.1
│   ├── 5.2.2
│   ├── 5.3.0
│   ├── 5.3.1
│   ├── 5.3.2
│   ├── 5.3.3
│   ├── 5.4.0
│   ├── 5.4.1
│   ├── 5.4.2
│   ├── 5.4.3
│   ├── 5.5.0
│   ├── 5.5.1
│   ├── 5.5.2
│   ├── 5.5.3
│   ├── 5.6.0
│   ├── 5.6.1
│   ├── 5.6.2
│   ├── 5.6.3
│   ├── 5.6.4
│   ├── 5.6.5
│   └── repodata
└── elastic-6.x
    ├── 6.0.0
    ├── 6.0.1
    ├── 6.1.0
    ├── 6.1.1
    └── repodata
34 directories, 0 files
[[email protected] opt]# tree -L 4 yum_data/puppet/
yum_data/puppet/
└── el
    └── 6
        ├── dependencies
        │   ├── i386
        │   └── x86_64
        ├── devel
        │   ├── i386
        │   └── x86_64
        └── products
            ├── i386
            └── x86_64
11 directories, 0 files

二、确定 yum 同步镜像地址

CentOS6 源:
rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/
rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/
rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/
EPEL 6/7源:
rsync://mirrors.ustc.edu.cn/epel/6/x86_64/
rsync://mirrors.ustc.edu.cn/epel/7/x86_64/
Zabbix 源:
rsync://mirror.tuna.tsinghua.edu.cn/zabbix/
Nginx 源:
rsync://mirrors.ustc.edu.cn/repo/nginx/centos/6/x86_64/
rsync://mirrors.ustc.edu.cn/repo/nginx/centos/7/x86_64/
Foreman 源:
rsync://rsync.theforeman.org/yum/releases/1.12/el6/x86_64/
rsync://rsync.theforeman.org/yum/plugins/1.12/el6/x86_64/
Remi 源:
rsync://mirror.tuna.tsinghua.edu.cn/remi/enterprise/6/remi/x86_64/
Repoforge 源:
rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el6/en/x86_64/rpmforge/
rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el7/en/x86_64/rpmforge/
rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el6/en/x86_64/extras/
rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el7/en/x86_64/extras/
Elasticstack 源:
rsync://mirror.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-5.x/
rsync://mirror.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-6.x/
Puppet 源:
rsync://rsync.puppet.com/packages/yum/el/6/dependencies/x86_64/
rsync://rsync.puppet.com/packages/yum/el/6/dependencies/i386/
rsync://rsync.puppet.com/packages/yum/el/6/devel/x86_64/
rsync://rsync.puppet.com/packages/yum/el/6/devel/i386/
rsync://rsync.puppet.com/packages/yum/el/6/products/x86_64/
rsync://rsync.puppet.com/packages/yum/el/6/products/i386/

三、同步 yum 源:

centos6源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/ /opt/yum_data/centos/6/os/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /opt/yum_data/centos/6/extras/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /opt/yum_data/centos/6/updates/x86_64/
EPEL6/7源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --exclude=debug --no-motd rsync://mirrors.ustc.edu.cn/epel/6/x86_64/ /opt/yum_data/epel/6/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --exclude=debug --no-motd rsync://mirrors.ustc.edu.cn/epel/7/x86_64/ /opt/yum_data/epel/7/x86_64/
Zabbix源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --exclude=debian --exclude=ubuntu --exclude=rhel/5 --exclude=rhel/6/i386  --exclude=rhel/6/SRPMS  --exclude=rhel/7/SRPMS --no-motd rsync://mirror.tuna.tsinghua.edu.cn/zabbix/ /opt/yum_data/zabbix/
NGINX源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirrors.ustc.edu.cn/repo/nginx/centos/6/x86_64/ /opt/yum_data/nginx/6/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirrors.ustc.edu.cn/repo/nginx/centos/7/x86_64/ /opt/yum_data/nginx/6/x86_64/
foreman源:
[[email protected] ~]# rsync --list-only rsync://rsync.theforeman.org/yum/releases/1.12/
[[email protected] ~]# rsync --list-only rsync://rsync.theforeman.org/yum/plugins/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.theforeman.org/yum/releases/1.12/el6/x86_64/ /opt/yum_data/foreman/releases/1.12/el6/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.theforeman.org/yum/plugins/1.12/el6/x86_64/ /opt/yum_data/foreman/plugins/1.12/el6/x86_64/
remi源:
[[email protected] ~]# rsync --list-only rsync://mirror.tuna.tsinghua.edu.cn/remi/enterprise/6/
[[email protected] ~]# /usr/bin/rsync -avz --progress --exclude=debug-*  --exclude=test* --exclude=php*/i386/ --exclude=remi/i386/ --exclude=safe/i386/ --exclude=index.html --no-motd rsync://mirror.tuna.tsinghua.edu.cn/remi/enterprise/6/remi/x86_64/ /opt/yum_data/remi/6/x86_64/remi/x86_64/
repoforge源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el6/en/x86_64/rpmforge/ /opt/yum_data/repoforge/rhel/el6/en/x86_64/rpmforge/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el7/en/x86_64/rpmforge/ /opt/yum_data/repoforge/rhel/el7/en/x86_64/rpmforge/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el6/en/x86_64/extras/ /opt/yum_data/repoforge/rhel/el6/en/x86_64/extras/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/repoforge/redhat/el7/en/x86_64/extras/ /opt/yum_data/repoforge/rhel/el7/en/x86_64/extras/
elasticstack源:
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-5.x/ /opt/yum_data/elasticstack/elastic-5.x/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://mirror.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-6.x/ /opt/yum_data/elasticstack/elastic-6.x/
puppet源:
[[email protected] ~]# /usr/bin/rsync -avz --no-motd rsync://rsync.puppet.com/packages/yum/el/6/dependencies/x86_64/ /opt/yum_data/puppet/el/6/dependencies/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --no-motd rsync://rsync.puppet.com/packages/yum/el/6/dependencies/i386/ /opt/yum_data/puppet/el/6/dependencies/i386/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.puppet.com/packages/yum/el/6/devel/x86_64/ /opt/yum_data/puppet/el/6/devel/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.puppet.com/packages/yum/el/6/devel/i386/ /opt/yum_data/puppet/el/6/devel/i386/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.puppet.com/packages/yum/el/6/products/x86_64/ /opt/yum_data/puppet/el/6/products/x86_64/
[[email protected] ~]# /usr/bin/rsync -avz --progress --no-motd rsync://rsync.puppet.com/packages/yum/el/6/products/i386/ /opt/yum_data/puppet/el/6/products/i386/

测试篇:

一、创建 yum 源的 repo 文件

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# more base.repo
[base]
enabled=1
baseurl=http://yum.base.com/centos/$releasever/os/$basearch/
path=/
gpgcheck=1
name=CentOS-$releasever - Base - yum.base.com
gpgkey=http://yum.base.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

二、测试 yum 源是否正确

[[email protected] ~]# yum clean all                                   #<--清除当前 yum 缓存
Loaded plugins: fastestmirror, security
Cleaning repos: base elastic-5.x elastic-6.x epel extras foreman foreman-plugins nginx remi rpmforge rpmforge-extras updates
: zabbix-client
Cleaning up Everything
Cleaning up list of fastest mirrors
[[email protected] yum.repos.d]# yum makecache 
Loaded plugins: fastestmirror, security
Determining fastest mirrors
base                                                                                                          | 3.7 kB     00:00     
base/group_gz                                                                                                 | 226 kB     00:00     
base/filelists_db                                                                                             | 6.4 MB     00:00     
base/primary_db                                                                                               | 4.7 MB     00:00     
base/other_db                                                                                                 | 2.8 MB     00:00     
elastic-5.x                                                                                                   | 2.9 kB     00:00     
elastic-5.x/filelists_db                                                                                      | 7.5 MB     00:00     
elastic-5.x/primary_db                                                                                        | 261 kB     00:00     
elastic-5.x/other_db                                                                                          |  18 kB     00:00     
elastic-6.x                                                                                                   | 2.9 kB     00:00     
elastic-6.x/filelists_db                                                                                      | 1.0 MB     00:00     
elastic-6.x/primary_db                                                                                        |  47 kB     00:00     
elastic-6.x/other_db                                                                                          | 4.2 kB     00:00     
epel                                                                                                          | 4.7 kB     00:00     
epel/group_gz                                                                                                 | 255 kB     00:00     
epel/filelists_db                                                                                             | 7.8 MB     00:00     
epel/prestodelta                                                                                              |  321 B     00:00     
epel/primary_db                                                                                               | 6.0 MB     00:00     
epel/other_db                                                                                                 | 3.0 MB     00:00     
extras                                                                                                        | 3.4 kB     00:00     
extras/filelists_db                                                                                           |  26 kB     00:00     
extras/prestodelta                                                                                            | 1.3 kB     00:00     
extras/primary_db                                                                                             |  29 kB     00:00     
extras/other_db                                                                                               |  30 kB     00:00     
foreman                                                                                                       | 2.9 kB     00:00     
foreman/filelists_db                                                                                          | 759 kB     00:00     
foreman/primary_db                                                                                            | 148 kB     00:00     
foreman/other_db                                                                                              |  84 kB     00:00     
foreman-plugins                                                                                               | 2.9 kB     00:00     
foreman-plugins/filelists_db                                                                                  | 289 kB     00:00     
foreman-plugins/primary_db                                                                                    |  68 kB     00:00     
foreman-plugins/other_db                                                                                      |  43 kB     00:00     
nginx                                                                                                         | 2.9 kB     00:00     
nginx/filelists_db                                                                                            |  36 kB     00:00     
nginx/primary_db                                                                                              |  32 kB     00:00     
nginx/other_db                                                                                                |  16 kB     00:00     
puppetlabs-deps                                                                                               | 2.5 kB     00:00     
puppetlabs-deps/filelists_db                                                                                  | 198 kB     00:00     
puppetlabs-deps/primary_db                                                                                    |  27 kB     00:00     
puppetlabs-deps/other_db                                                                                      |  21 kB     00:00     
puppetlabs-products                                                                                           | 2.5 kB     00:00     
puppetlabs-products/filelists_db                                                                              | 1.0 MB     00:00     
puppetlabs-products/primary_db                                                                                | 170 kB     00:00     
puppetlabs-products/other_db                                                                                  | 194 kB     00:00     
remi                                                                                                          | 2.9 kB     00:00     
remi/filelists_db                                                                                             | 2.4 MB     00:00     
remi/primary_db                                                                                               | 2.0 MB     00:00     
remi/other_db                                                                                                 | 976 kB     00:00     
rpmforge                                                                                                      | 1.9 kB     00:00     
rpmforge/filelists_db                                                                                         | 2.3 MB     00:00     
rpmforge/primary_db                                                                                           | 2.7 MB     00:00     
rpmforge/other_db                                                                                             | 575 kB     00:00     
rpmforge-extras                                                                                               | 1.9 kB     00:00     
rpmforge-extras/filelists_db                                                                                  | 335 kB     00:00     
rpmforge-extras/primary_db                                                                                    | 472 kB     00:00     
rpmforge-extras/other_db                                                                                      |  92 kB     00:00     
updates                                                                                                       | 3.4 kB     00:00     
updates/filelists_db                                                                                          | 3.5 MB     00:00     
updates/prestodelta                                                                                           | 171 kB     00:00     
updates/primary_db                                                                                            | 5.8 MB     00:00     
updates/other_db                                                                                              |  83 MB     00:01     
zabbix-client                                                                                                 | 2.9 kB     00:00     
zabbix-client/filelists_db                                                                                    |  64 kB     00:00     
zabbix-client/primary_db                                                                                      |  86 kB     00:00     
zabbix-client/other_db                                                                                        |  60 kB     00:00     
Metadata Cache Created
[[email protected] ~]# yum repolist                           #<--列出 yum 源中可用的软件包
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
repo id                                          repo name                                                                     status
base                                             CentOS-6 - Base - yum.base.com                                                 6,706
elastic-5.x                                      Elastic repository for 5.x packages                                              302
elastic-6.x                                      Elastic repository for 6.x packages                                               60
epel                                             Extra Packages for Enterprise Linux 6 - x86_64                                12,448
extras                                           CentOS-6 - Extras - yum.base.com                                                  47
foreman                                          Foreman 1.12                                                                     460
foreman-plugins                                  Foreman 1.12                                                                     240
nginx                                            nginx-6 - yum.base.com                                                            90
puppetlabs-deps                                  Puppet Labs Dependencies El 6 - x86_64                                            77
puppetlabs-products                              Puppet Labs Products El 6 - x86_64                                               564
remi                                             Les RPM de remi pour Enterprise Linux 6 - x86_64                               4,890
rpmforge                                         RHEL 6 - yum.base/rpmforge - dag                                               4,718
rpmforge-extras                                  RHEL 6 - yum.base/extras - dag                                                   711
updates                                          CentOS-6 - Updates - yum.base.com                                                858
zabbix-client                                    zabbix client repo for yum.base.com                                              170
repolist: 32,341
[[email protected] ~]# yum install htop                      #<--测试 rpmforge 源
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
base                                                                                                          | 3.7 kB     00:00     
elastic-5.x                                                                                                   | 2.9 kB     00:00     
elastic-6.x                                                                                                   | 2.9 kB     00:00     
epel                                                                                                          | 4.7 kB     00:00     
extras                                                                                                        | 3.4 kB     00:00     
foreman                                                                                                       | 2.9 kB     00:00     
foreman-plugins                                                                                               | 2.9 kB     00:00     
nginx                                                                                                         | 2.9 kB     00:00     
remi                                                                                                          | 2.9 kB     00:00     
rpmforge                                                                                                      | 1.9 kB     00:00     
rpmforge-extras                                                                                               | 1.9 kB     00:00     
updates                                                                                                       | 3.4 kB     00:00     
zabbix-client                                                                                                 | 2.9 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package htop.x86_64 0:1.0.3-1.el6.rf will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package                    Arch                         Version                                Repository                      Size
=====================================================================================================================================
Installing:
htop                       x86_64                       1.0.3-1.el6.rf                         rpmforge                        87 k
Transaction Summary
=====================================================================================================================================
Install       1 Package(s)
Total download size: 87 k
Installed size: 209 k
[[email protected] ~]# yum install php
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.45-13.el6.remi will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.45-13.el6.remi for package: php-5.4.45-13.el6.remi.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.4.45-13.el6.remi for package: php-5.4.45-13.el6.remi.x86_64
--> Processing Dependency: httpd-mmn = 20051115 for package: php-5.4.45-13.el6.remi.x86_64
--> Processing Dependency: httpd for package: php-5.4.45-13.el6.remi.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-60.el6.centos.6 will be installed
--> Processing Dependency: httpd-tools = 2.2.15-60.el6.centos.6 for package: httpd-2.2.15-60.el6.centos.6.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-60.el6.centos.6.x86_64
---> Package php-cli.x86_64 0:5.4.45-13.el6.remi will be installed
---> Package php-common.x86_64 0:5.4.45-13.el6.remi will be installed
--> Running transaction check
---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package httpd-tools.x86_64 0:2.2.15-60.el6.centos.6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package                         Arch                     Version                                    Repository                 Size
=====================================================================================================================================
Installing:
php                             x86_64                   5.4.45-13.el6.remi                         remi                      2.8 M
Installing for dependencies:
apr-util-ldap                   x86_64                   1.3.9-3.el6_0.1                            base                       15 k
httpd                           x86_64                   2.2.15-60.el6.centos.6                     updates                   836 k
httpd-tools                     x86_64                   2.2.15-60.el6.centos.6                     updates                    80 k
php-cli                         x86_64                   5.4.45-13.el6.remi                         remi                      4.1 M
php-common                      x86_64                   5.4.45-13.el6.remi                         remi                      968 k
Transaction Summary
=====================================================================================================================================
Install       6 Package(s)
Total download size: 8.8 M
Installed size: 32 M
参数篇:

--progress:可以显示同步的进度,包括文件传输完成进度、传输速率信息

--no-motd:此选项会影响客户端在守护程序传输开始时输出的信息。它会禁止 motd 信息,但是也会影响 daemon 对 "rsync host::" 请求显示模块列表的回应信息,因此如果想要请求 daemon 的模块列表,应该忽略该选项。

--list-only:该选项强制 rsync 仅列出源路径的文件列表而不是进行文件传输。如果 rsync 命令行中只给出了一个地址,将隐含该选项。注意通配符会被 shell 解析并扩展为 rsync 的参数。

-z:传输前进行压缩

-a:归档模式,表示以递归方式传输文件,并保持所有文件属性,等于 -rlptgoD

-v:显示命令执行详细信息


以上是关于通过 rsync 搭建 CentOS 本地 yum 源服务器的主要内容,如果未能解决你的问题,请参考以下文章

搭建内网Yum源服务器[使用rsync同步更新]

如何实现本地yum源的共享

CentOS 如何搭建本地和局域网yum源

CentOS7 搭建 rsync 服务器

搭建CentOS在线yum源镜像服务器

Centos 7 通过挂载系统光盘搭建本地yum仓库的方法