爲了方便在局域網中安裝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),獲取更多資訊