標籤:yum 倉庫
適用情境:
1.大型叢集中的應用伺服器只能內網訪問
2.希望保持穩定的本機存放區庫,保證成員伺服器統一安裝
3.避免因為國外yum源或者國內源網路不佳的情況訪問
伺服器配置:
-
建立應用本地yum源設定檔,確保網路正常訪問公網源,以CDH為例
[[email protected] ~]# cat /etc/yum.repos.d/cdh.repo [cloudera-cdh5]# Packages for Cloudera‘s Distribution for Hadoop, Version 5, on RedHator CentOS 6 x86_64name=Cloudera‘s Distribution for Hadoop, Version 5baseurl=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檔案伺服器,能讓其他伺服器通過網路方式訪問源
[[email protected] ~]# /etc/init.d/httpd startStarting httpd: [ OK ]
3.安裝createrepo,reposync工具
[[email protected] ~]#yum install yum-utils createrepo -y
4.將源中的rpm同步到本地
[[email protected] html]# pwd/var/www/html[[email protected] html~]#reposync -r cloudera-cdh5 #cloudera-cdh5指cdh.repo中的源名稱[[email protected] html]# mv cloudera-cdh5 cdh
5.規範目錄及命名方式,/本地目錄/項目名稱/版本號碼/RPMS/架構平台
[[email protected] 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.建立版本倉庫資訊
[[email protected] html]# cd cdh/5/[[email protected] 5]# createrepo .Spawning worker 0 with 118 pkgsWorkers FinishedGathering worker resultsSaving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete[[email protected] 5]# lsrepodata RPMS
7.用戶端斷網測試
[[email protected] ~]# cat /etc/yum.repos.d/cdh5.repo [cloudera-cdh5]name=cdh5baseurl=http://192.168.2.54/cdh/5/gpgcheck=0[[email protected] ~]# yum makecacheLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfilecloudera-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倉庫