码迷,mamicode.com
首页 > 其他好文 > 详细

创建应用yum仓库

时间:2015-11-13 19:09:55      阅读:328      评论:0      收藏:0      [点我收藏+]

标签:yum   仓库   

适用场景:

   1.大型集群中的应用服务器只能内网访问

   2.希望保持稳定的本地存储库,保证成员服务器统一安装

   3.避免因为国外yum源或者国内源网络不佳的情况访问

服务器配置:

  1. 创建应用本地yum源配置文件,确保网络正常访问公网源,以CDH为例

[root@vm03 ~]# cat /etc/yum.repos.d/cdh.repo 
[cloudera-cdh5]
# Packages for Cloudera‘s Distribution for Hadoop, Version 5, on RedHat	or CentOS 6 x86_64
name=Cloudera‘s Distribution for Hadoop, Version 5
baseurl=http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/5/
gpgkey = http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera    
gpgcheck = 1

2.在RPM服务器上安装Apache/nginx或者ftp等web文件服务器,能让其他服务器通过网络方式访问源

[root@vm03 ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]

3.安装createrepo,reposync工具

[root@vm03 ~]#yum install yum-utils createrepo -y

4.将源中的rpm同步到本地

[root@vm03 html]# pwd
/var/www/html
[root@vm03 html~]#reposync -r cloudera-cdh5     #cloudera-cdh5指cdh.repo中的源名称
[root@vm03 html]# mv cloudera-cdh5 cdh

5.规范目录及命名方式,/本地目录/项目名称/版本号/RPMS/架构平台

[root@vm03 html]# tree 
.
└── cdh
    └── 5
        └── RPMS
            ├── noarch
            │   ├── avro-doc-1.7.6+cdh5.4.8+97-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── avro-libs-1.7.6+cdh5.4.8+97-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── avro-tools-1.7.6+cdh5.4.8+97-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── bigtop-tomcat-0.7.0+cdh5.4.8+0-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── bigtop-utils-0.7.0+cdh5.4.8+0-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── crunch-0.11.0+cdh5.4.8+76-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── crunch-doc-0.11.0+cdh5.4.8+76-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── flume-ng-1.5.0+cdh5.4.8+137-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── flume-ng-agent-1.5.0+cdh5.4.8+137-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── flume-ng-doc-1.5.0+cdh5.4.8+137-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── hbase-solr-1.5+cdh5.4.8+60-1.cdh5.4.8.p0.5.el6.noarch.rpm
            │   ├── hbase-solr-doc-1.5+cdh5.4.8+60-1.cdh5.4.8.p0.5.el6.noarch.rpm
            └── x86_64
                ├── bigtop-jsvc-0.6.0+cdh5.4.8+684-1.cdh5.4.8.p0.5.el6.x86_64.rpm
                ├── bigtop-jsvc-debuginfo-0.6.0+cdh5.4.8+684-1.cdh5.4.8.p0.5.el6.x86_64.rpm
                ├── hadoop-0.20-conf-pseudo-2.6.0+cdh5.4.8+669-1.cdh5.4.8.p0.5.el6.x86_64.rpm
                ├── hadoop-0.20-mapreduce-2.6.0+cdh5.4.8+669-1.cdh5.4.8.p0.5.el6.x86_64.rpm
                ├── hadoop-0.20-mapreduce-jobtracker-2.6.0+cdh5.4.8+669-1.cdh5.4.8.p0.5.el6.x86_64.rpm
                ├── hadoop-0.20-mapreduce-jobtrackerha-2.6.0+cdh5.4.8+669-1.cdh5.4.8.p0.5.el6.x86_64.rpm

6.建立版本仓库信息

[root@vm03 html]# cd cdh/5/
[root@vm03 5]# createrepo .
Spawning worker 0 with 118 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@vm03 5]# ls
repodata  RPMS

7.客户端断网测试

[root@vm02 ~]# cat /etc/yum.repos.d/cdh5.repo 
[cloudera-cdh5]
name=cdh5
baseurl=http://192.168.2.54/cdh/5/
gpgcheck=0
[root@vm02 ~]# yum makecache
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
cloudera-cdh5                                                                                                                                                           | 2.9 kB     00:00     
cloudera-cdh5/filelists_db                                                                                                                                              | 390 kB     00:00     
cloudera-cdh5/primary_db                                                                                                                                                |  66 kB     00:00     
cloudera-cdh5/other_db                                                                                                                                                  | 7.7 kB     00:00     
Metadata Cache Created


本文出自 “技术小菜” 博客,请务必保留此出处http://390892467.blog.51cto.com/2006821/1712588

创建应用yum仓库

标签:yum   仓库   

原文地址:http://390892467.blog.51cto.com/2006821/1712588

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!