为了方便在局域网中安装CDH集群,搭建一个CDH的yum本地源,方便局域网内各节点安装。html
在Cloudera的官网中给出了CDH本地源的搭建过程(官网说明文档连接),下面是本人亲自搭建的详细过程,首先要找一台能联网的主机来制做本地源,可自动下载必要的安装包(若是所有都没法联网,则手动下载相关的rpm安装包,只是麻烦了一些,过程是同样的),制做好本地源后该主机再断网给本地局域网做为yum源使用便可。linux
一、关闭防火墙、关闭selinuxapache
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
二、下载repo文件centos
根据操做系统下载repo文件(本人使用的是centos 6.9,x86_64位),到cloudera官网上下载repo文件,这是centos6对应的repo文件下载连接bash
下载后,将cloudera-cdh5.repo文件保存到/etc/yum.repos.d/目录下服务器
三、安装本地http服务器微信
官网推荐的http服务器是lighttpd,这是一款极轻量级的http服务器,安装也很是简单ide
yum install epel-release yum update yum install lighttpd
本人习惯使用apache httpd,所以最后安装的是apache httpdoop
yum install httpd
设置可读取目录列表,对于lighttpd的设置以下:大数据
vi /etc/lighttpd/conf.d/dirlisting.conf dir-listing.activate = "enable" dir-listing.hide-dotfiles = "enable"
对于apache httpd的设置方式为修改httpd.conf文件,加入如下配置项
<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow allow from all </Directory>
四、制做repo文件
安装createrepo程序
sudo yum install yum-utils createrepo
下载CDH相关的rpm包
reposync -r cloudera-cdh5
将下载的rpm包放到http服务器的目录
/var/www/html/cdh/5/RPMS/x86_64
在该http目录下,制做repo文件
# 注意后面加上空格和点,表示当前目录 createrepo .
下载RPM-GPG-KEY-cloudera文件,放到该http目录下,下载连接
五、修改repo文件中的本地源
修改/etc/yum.repos.d/cloudera-cdh5.repo中的下载url,指向本地源
baseurl=http://172.17.0.2/cdh/5/
六、更新源,安装CDH hadoop
yum update yum install hadoop
而后再安装JDK,安装后cdh-hadoop就能运行了,很是方便。
欢迎关注本人的微信公众号“大数据与人工智能Lab”(BigdataAILab),获取更多资讯