搭建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就能运行了

 

posted @ 2020-04-21 17:32  walkersss  阅读(1409)  评论(1编辑  收藏  举报