搭建内网yum源

阅读(2,238)

一:因内网服务器 众多,当统一安装一些比较大的rpm的时候全部从外网下载就比较慢,而且还占用了一定的出口流量,因此在内网部署了一台yum服务器,将阿里云的epel源、zabbix、Base等定时镜像到一台单独的内网服务器,然后将其他内网服务器的yum地址全部指向此服务器以加快内网安装rpm包的速度,具体如下:

1.1:以镜像阿里云的zabbix 3.0 rhel7的yum源为例,先安装cobbler命令,然后添加repo源:

[root@aqdl repo_mirror]# cobbler  repo add  --name=zabbix --mirror=http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/ --arch=x86_64  --breed=yum #添加repo文件
[root@aqdl repo_mirror]# cobbler reposync #执行同步
task started: 2017-02-14_044922_reposync
task started (id=Reposync, time=Tue Feb 14 04:49:22 2017)
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/zabbix/config.repo
creating: /var/www/cobbler/repo_mirror/zabbix/.origin/zabbix.repo #其实就是通过命令/usr/bin/reporsync 进行的同步
running: /usr/bin/reposync -l -n -d --config=/var/www/cobbler/repo_mirror/zabbix/.origin/zabbix.repo --repoid=zabbix --download_path=/var/www/cobbler/repo_mirror -a x86_64
received on stdout: Repository zabbix is listed more than once in the configuration
951 B 00:00
15 kB 00:02
229 kB 00:02
329 kB 00:02
712 kB 00:00
611 kB 00:00
597 kB 00:00
11 kB 00:00
240 kB 00:00
611 kB 00:01
1.7 MB 00:02
1.7 MB 00:03
4.8 kB 00:00
4.3 kB 00:00
4.3 kB 00:00
3.5 MB 00:04 received on stderr:
running: createrepo -c cache -s sha /var/www/cobbler/repo_mirror/zabbix
received on stdout: Spawning worker 0 with 7 pkgs
Spawning worker 1 with 7 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete received on stderr:
running: chown -R root:apache /var/www/cobbler/repo_mirror/zabbix
received on stdout:
received on stderr:
running: chmod -R 755 /var/www/cobbler/repo_mirror/zabbix
received on stdout:
received on stderr:
*** TASK COMPLETE ***

1.2:查看同步后的目录:

[root@aqdl ~]# ls /var/www/cobbler/repo_mirror/zabbix/
cache
config.repo
repodata
zabbix-agent-3.0.7-1.el7.x86_64.rpm
zabbix-get-3.0.7-1.el7.x86_64.rpm
zabbix-java-gateway-3.0.7-1.el7.x86_64.rpm
zabbix-proxy-mysql-3.0.7-1.el7.x86_64.rpm
zabbix-proxy-pgsql-3.0.7-1.el7.x86_64.rpm
zabbix-proxy-sqlite3-3.0.7-1.el7.x86_64.rpm
zabbix-release-3.0-1.el7.noarch.rpm
zabbix-sender-3.0.7-1.el7.x86_64.rpm
zabbix-server-mysql-3.0.7-1.el7.x86_64.rpm
zabbix-server-pgsql-3.0.7-1.el7.x86_64.rpm
zabbix-web-3.0.7-1.el7.noarch.rpm
zabbix-web-japanese-3.0.7-1.el7.noarch.rpm
zabbix-web-mysql-3.0.7-1.el7.noarch.rpm
zabbix-web-pgsql-3.0.7-1.el7.noarch.rpm

1.3:使用一台内网服务器配置yum源进行测试:

[root@bogon ~]# vim /etc/yum.repos.d/zabbix.repo
[local-zabbix]
name=local zabbix
baseurl=http://192.168.10.100/cobbler/repo_mirror/zabbix/ #cobbler服务器的地址,zabbix目录为镜像的阿里的zabbix源
enabled=1
gpgcheck=0

1.4:验证安装zabbix 客户端:

[root@bogon ~]# yum install zabbix-agent
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package zabbix-agent.x86_64 0:3.0.7-1.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ====================================================================================
 Package              Arch           Version             Repository            Size
====================================================================================
Installing:
 zabbix-agent         x86_64         3.0.7-1.el7         local-zabbix         329 k Transaction Summary
====================================================================================
Install  1 Package Total download size: 329 k
Installed size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
zabbix-agent-3.0.7-1.el7.x86_64.rpm                                                                                     | 329 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : zabbix-agent-3.0.7-1.el7.x86_64                                                                                             1/1
  Verifying  : zabbix-agent-3.0.7-1.el7.x86_64                                                                                             1/1

1.5:设置定时任务计划,每天晚上2点定时更新:

0 2  * * * cobbler reposync &> /dev/null

1.6:epel源及base源等配置方法同上,如下:

[root@aqdl ~]# cobbler repo add  --name=epel --mirror=https://mirrors.aliyun.com/epel/7/x86_64/   --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler repo add  --name=saltstack --mirror=http://repo.saltstack.com/yum/redhat/latest/x86_64/latest/  --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler  repo add  --name=openstack-mitaka  --mirror=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-mitaka/  --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler  repo add  --name=updates  --mirror=https://mirrors.aliyun.com/centos/7/updates/x86_64/   --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler  repo add  --name=extras   --mirror=https://mirrors.aliyun.com/centos/7/extras/x86_64/  --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler  repo add  --name=os   --mirror=https://mirrors.aliyun.com/centos/7/os/x86_64/  --arch=x86_64  --breed=yum
[root@aqdl ~]# cobbler reposync #在夜深人静的时候同步效果显著!

1.7:验证最同步后的仓库大小并通过浏览器访问方库:

1.7.1:最终同步后的大小:

[root@aqdl ~]# cd /var/www/cobbler/repo_mirror/
[root@aqdl repo_mirror]# du -sh ./* #以下只包含centos 7的yum仓库
12G ./epel
527M ./extras
583M ./openstack-mitaka
7.4G ./os
27M ./saltstack
1.3G ./updates
11M ./zabbix

1.7.2:通过浏览器验证效果:

1.8:在内网服务器使用内网的yum源安装openstack进行测试能否正常安装:

1.8.1:内网yum源配置:

mv /etc/yum.repos.d/*.repo /tmp/
cat  <<  EOF  >  /etc/yum.repos.d/zabbix-local.repo
[zabbix-local]
name=zabbix-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/zabbix/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/saltstack-local.repo
[saltstack-local]
name=saltstack-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/saltstack/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/epel-local.repo
[epel-local]
name=epel-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/epel/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/openstack-mitaka-local.repo
[openstack-mitaka-local]
name=openstack-mitaka-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/openstack-mitaka/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/OS-local.repo
[OS-local]
name=BaseOS-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/os/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/extras-local.repo
[extras-local]
name=extras-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/extras/
enabled=1
gpgcheck=0
EOF cat  <<  EOF  >  /etc/yum.repos.d/updates-local.repo
[updates-local]
name=updates-local
baseurl=http://192.168.10.100/cobbler/repo_mirror/updates/
enabled=1
gpgcheck=0
EOF

1.8.2:测试yum安装rpm包:

[root@aqdl kickstarts]# yum install bind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.9.4-38.el7_3.1 will be installed
--> Processing Dependency: bind-libs = 32:9.9.4-38.el7_3.1 for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: liblwres.so.90()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libisccfg.so.90()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libisccc.so.90()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libisc.so.95()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libdns.so.100()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libbind9.so.90()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Processing Dependency: libGeoIP.so.1()(64bit) for package: 32:bind-9.9.4-38.el7_3.1.x86_64
--> Running transaction check
---> Package GeoIP.x86_64 0:1.5.0-11.el7 will be installed
---> Package bind-libs.x86_64 32:9.9.4-38.el7_3.1 will be installed
--> Processing Dependency: bind-license = 32:9.9.4-38.el7_3.1 for package: 32:bind-libs-9.9.4-38.el7_3.1.x86_64
--> Running transaction check
---> Package bind-license.noarch 32:9.9.4-29.el7 will be updated
--> Processing Dependency: bind-license = 32:9.9.4-29.el7 for package: 32:bind-libs-lite-9.9.4-29.el7.x86_64
---> Package bind-license.noarch 32:9.9.4-38.el7_3.1 will be an update
--> Running transaction check
---> Package bind-libs-lite.x86_64 32:9.9.4-29.el7 will be updated
---> Package bind-libs-lite.x86_64 32:9.9.4-38.el7_3.1 will be an update
--> Finished Dependency Resolution Dependencies Resolved ===============================================================================================================================================
 Package                            Arch                       Version                                 Repository                         Size
===============================================================================================================================================
Installing:
 bind                               x86_64                     32:9.9.4-38.el7_3.1                     updates-local                     1.8 M
Installing for dependencies:
 GeoIP                              x86_64                     1.5.0-11.el7                            OS-local                          1.1 M
 bind-libs                          x86_64                     32:9.9.4-38.el7_3.1                     updates-local                     1.0 M
Updating for dependencies:
 bind-libs-lite                     x86_64                     32:9.9.4-38.el7_3.1                     updates-local                     729 k
 bind-license                       noarch                     32:9.9.4-38.el7_3.1                     updates-local                      83 k Transaction Summary
===============================================================================================================================================
Install  1 Package  (+2 Dependent packages)
Upgrade             ( 2 Dependent packages) Total download size: 4.6 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for updates-local
(1/5): GeoIP-1.5.0-11.el7.x86_64.rpm                                                                                    | 1.1 MB  00:00:00     
(2/5): bind-9.9.4-38.el7_3.1.x86_64.rpm                                                                                 | 1.8 MB  00:00:00     
(3/5): bind-libs-lite-9.9.4-38.el7_3.1.x86_64.rpm                                                                       | 729 kB  00:00:00     
(4/5): bind-libs-9.9.4-38.el7_3.1.x86_64.rpm                                                                            | 1.0 MB  00:00:00     
(5/5): bind-license-9.9.4-38.el7_3.1.noarch.rpm                                                                         |  83 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                           22 MB/s | 4.6 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : GeoIP-1.5.0-11.el7.x86_64                                                                                                   1/7
  Updating   : 32:bind-license-9.9.4-38.el7_3.1.noarch                                                                                     2/7
  Installing : 32:bind-libs-9.9.4-38.el7_3.1.x86_64                                                                                        3/7
  Installing : 32:bind-9.9.4-38.el7_3.1.x86_64                                                                                             4/7
  Updating   : 32:bind-libs-lite-9.9.4-38.el7_3.1.x86_64                                                                                   5/7
  Cleanup    : 32:bind-libs-lite-9.9.4-29.el7.x86_64                                                                                       6/7
  Cleanup    : 32:bind-license-9.9.4-29.el7.noarch                                                                                         7/7
  Verifying  : 32:bind-libs-9.9.4-38.el7_3.1.x86_64                                                                                        1/7
  Verifying  : GeoIP-1.5.0-11.el7.x86_64                                                                                                   2/7
  Verifying  : 32:bind-license-9.9.4-38.el7_3.1.noarch                                                                                     3/7
  Verifying  : 32:bind-9.9.4-38.el7_3.1.x86_64                                                                                             4/7
  Verifying  : 32:bind-libs-lite-9.9.4-38.el7_3.1.x86_64                                                                                   5/7
  Verifying  : 32:bind-license-9.9.4-29.el7.noarch                                                                                         6/7
  Verifying  : 32:bind-libs-lite-9.9.4-29.el7.x86_64                                                                                       7/7 Installed:
  bind.x86_64 32:9.9.4-38.el7_3.1                                                                                                               Dependency Installed:
  GeoIP.x86_64 0:1.5.0-11.el7                                       bind-libs.x86_64 32:9.9.4-38.el7_3.1                                       Dependency Updated:
  bind-libs-lite.x86_64 32:9.9.4-38.el7_3.1                               bind-license.noarch 32:9.9.4-38.el7_3.1                               Complete!

搭建内网Yum源的更多相关文章

  1. RadHat搭建内网YUM源server

    前言:随着内网linuxserver越来越多,在每台server上安装软件.都要先把安装盘上传上去.在配置本地yum服务,即麻烦又费时.能够在内网的一台linuxserver上安装yum服务,然后其它 ...

  2. #centos7 创建内网yum源 OpenStack源部署

    #centos7 创建内网yum源#centos7 自动化安装 本地 内网 web源创建.更新 createrepo http OpenStack源部署 Elven原创 http://www.cnbl ...

  3. 【转】内网yum源搭建

    我们内网yum要玩的话,先加hosts,然后找运维要CentOS_base.repo这个文件,然后yum clean all   && yum makecache ========== ...

  4. Linux学习笔记5-搭建内网Yum源

    一.安装Nginx  1.安装依赖: [root@nodeSource local]# yum install gc-devel gcc-c++ pcre-devel zlib-devel 2.解压N ...

  5. 公司内网yum源

    新增yum源配置文件 vi /etc/yum.repos.d/szyum.repo 内容如下: #[redhat6.3] [base] name=redhat63 baseurl=http://10. ...

  6. 利用nginx 来实现内网yum源(反向代理)

    简介 在项目部署时,尤其是在政府企业,对于外网简直是奢望,但是对于运维来说,没有外网的话只能自建yum源.我今天来说的是一种简单的自建yum源方法,前提是必须有一台内外网都有的机器,我们一般称为前置机 ...

  7. linux 配置内网yum源

    一.yum服务器端配置1.安装FTP软件#yum install vsftpd #service vsftpd start#chkconfig --add vsftpd#chkconfig vsftp ...

  8. linux里如何配置本地yum源和外网yum源

    一:本地和外网源配置方法 二:外网YUM源的地址 一: ① 本地源配置方法:以光盘里rpm举例(这里使用虚拟机演示) 1.挂载一个iso的镜像 把光盘挂载到一个目录里,然后进入/etc/yum.rep ...

  9. bind搭建内网DNS服务器架构(主从、子域授权、DNS转发器)

    实验目的 模拟企业DNS服务架构服务器及原理 实验环境准备 实验架构图 实验设备 DNS服务器4台 主服务器master(centos8):IP_192.168.100.30, 从服务器slave(r ...

随机推荐

  1. [JS]什么是闭包?

    首先来思考一下下面的案例: function unclosure() { let count = 0 return count++ } for (let index = 0; index < 1 ...

  2. Part 28 AngularJS default route

    At the moment the problem is that, if you try to navigate to a route that is not configured, you wil ...

  3. ES6-正则新增(复习+学习)

    ES6-正则 昨天,复习了正则的基本知识,今天学习ES6新增的正则的知识,做一个总结笔记,大家可以先看4,5对应的方法然后再从头看,话不多说直接上: 1.RegExp构造函数的区别 2.新增的修饰符 ...

  4. 一文看懂socket编程

    1.网络模型的设计模式 1.1 B/S模式 B/S: Browser/Server,浏览器/服务器模式,在一端部署服务器,在另外外一端使用默认配置的浏览器即可完成数据的传输. B/S结构是随着互联网的 ...

  5. Veeam Backup & Replication 10.0.0.4461安装部署(包含补丁)

    Veeam Backup & Replication 是一款数据保护软件,为VMware 和Hyper-V 虚拟机.物理与云环境提供了备份.复制与恢复选项.如有需要请去官方购买正版授权:htt ...

  6. OAuth 2.1 的进化之路

    背景 2010年, OAuth 授权规范 1.0 (rfc 5849) 版本发布, 2年后, 更简单易用的 OAuth 2.0 规范发布(rfc 6749), 这也是大家最熟悉并且在互联网上使用最广泛 ...

  7. 国内首家!腾讯云正式成为 FinOps 基金会顶级会员

    11月24日,腾讯云正式宣布加入FinOps基金会,作为国内首家FinOps基金会顶级会员,腾讯云将联合FinOps基金会,全面推进对FinOps标准和最佳实践的贡献,为企业提供云财务管理的最佳解决方 ...

  8. 洛谷 P4062 - [Code+#1]Yazid 的新生舞会(权值线段树)

    题面传送门 题意: 给出一个序列 \(a\),求 \(a\) 有多少个子区间 \([l,r]\),满足这个区间中出现次数最多的数出现次数 \(>\dfrac{r-l+1}{2}\) \(1 \l ...

  9. Codeforces 575A - Fibonotci

    题面传送门 题意: 给出 \(s_0,s_1,s_2,\dots,s_{n-1}\),对于 \(i\geq n\),有 \(m\) 个 \(s_i\) 满足 \(s_i\neq s_{i\bmod n ...

  10. C++ and OO Num. Comp. Sci. Eng. - Part 4.

    命名空间与文件(Namespaces and Files) 在 C++ 中,命名空间为包含相关声明与定义的逻辑单元. 将一个大程序分割为不同部分并且将其储存在不同的文件中可以实现模块化编程. 未命名的 ...