搭建CDH的yum本地源


https://my.oschina.net/u/876354/blog/1610253

https://my.oschina.net/u/876354   博主  雪餅

http://archive.cloudera.com/cdh5/

https://archive.cloudera.com/cdh6/

為了方便在局域網中安裝CDH集群,搭建一個CDH的yum本地源,方便局域網內各節點安裝。

在Cloudera的官網中給出了CDH本地源的搭建過程(官網說明文檔鏈接),下面是本人親自搭建的詳細過程,首先要找一台能聯網的主機來制作本地源,可自動下載必要的安裝包(如果全部都無法聯網,則手動下載相關的rpm安裝包,只是麻煩了一些,過程是一樣的),制作好本地源后該主機再斷網給本地局域網作為yum源使用即可。

1、關閉防火牆、關閉selinux

service iptables stop
chkconfig iptables off

[root@test001 selinux]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

2、下載repo文件

根據操作系統下載repo文件(本人使用的是centos 7.4,x86_64位),到cloudera官網上下載repo文件,這是centos7對應的repo文件

下載鏈接:https://archive.cloudera.com/cdh5/redhat/7/x86_64/cdh/
cloudera-cdh5.repo
RPM-GPG-KEY-cloudera

下載后,將cloudera-cdh5.repo文件保存到/etc/yum.repos.d/目錄下

3、安裝本地http服務器

官網推薦的http服務器是lighttpd,這是一款極輕量級的http服務器,安裝也非常簡單

yum install epel-release
yum update
yum install lighttpd

本人習慣使用apache httpd,因此最后安裝的是apache httpd

yum install httpd

設置可讀取目錄列表,對於lighttpd的設置如下:

vi /etc/lighttpd/conf.d/dirlisting.conf
dir-listing.activate      = "enable"
dir-listing.hide-dotfiles = "enable"

對於apache httpd的設置方式為修改httpd.conf文件,加入以下配置項
cd /etc/httpd/conf

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Order deny,allow
  allow from all
</Directory>

4、制作repo文件
安裝createrepo程序
yum install yum-utils createrepo

下載CDH相關的rpm包
cd /var/www/html/
reposync -r cloudera-cdh5

在該目錄下,制作repodata文件
createrepo -d /var/www/html/cloudera-cdh5/RPMS

下載RPM-GPG-KEY-cloudera文件,放到/var/www/html/cloudera-cdh5/RPMS 目錄下,
下載鏈接:https://archive.cloudera.com/cdh5/redhat/7/x86_64/cdh/

5、修改repo文件中的本地源

修改/etc/yum.repos.d/cloudera-cdh5.repo中的下載url,指向本地源

cat cloudera-cdh5.repo
[cloudera-cdh5]
# Packages for Cloudera's Distribution for Hadoop, Version 5, on RedHat or CentOS 7 x86_64
name=Cloudera's Distribution for Hadoop, Version 5
#baseurl=https://archive.cloudera.com/cdh5/redhat/7/x86_64/cdh/5/
baseurl=http://192.168.80.131/cloudera-cdh5/RPMS
gpgkey =http://192.168.80.131/cloudera-cdh5/RPMS/RPM-GPG-KEY-cloudera    
gpgcheck = 1

systemctl start httpd
systemctl enable httpd

6、更新源,安裝CDH hadoop

yum update
yum install hadoop

然后再安裝JDK,安裝后cdh-hadoop就能運行了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM