打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Hadoop学习之路(三)Hadoop

目录

 

正文

下载Hadoop源码

1、登录官网

2、确定你要安装的软件的版本

一个选取原则: 不新不旧的稳定版本

几个标准:

  1)一般来说,刚刚发布的大版本都是有很多问题

  2)应该选择某个大版本中的最后一个小版本

阅读编译文档

1、准备一个hadoop源码包,我选择的hadoop的版本是:hadoop-2.7.5-src.tar.gz,在hadoop-2.7.5-src.tar.gz的源码包根目录下有一个文档叫做BUINDING.txt,这其中说明了编译hadoop所需要的一些编译环境相关的东西。不同的hadoop版本的要求都不一样。对应的版本参照BUINDING.txt。

Requirements:* Unix System* JDK 1.7+* Maven 3.0 or later* Findbugs 1.3.9 (if running findbugs)* ProtocolBuffer 2.5.0* CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac* Zlib devel (if compiling native code)* openssl devel ( if compiling native hadoop-pipes and to get the best HDFS encryption performance )* Linux FUSE (Filesystem in Userspace) version 2.6 or above ( if compiling fuse_dfs )* Internet connection for first build (to fetch all Maven and Hadoop dependencies)

 

软件安装

对应以上需求,我们准备好所要求版本的这些软件。

JDK的安装

选择版本:jdk1.8.0_73

安装依赖包

根据编译指导文件BUILDING.txt,安装相关依赖程序包

[root@master soft]# yum -y install gcc-c++ build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-devua svn openssl-devel ncurses-devel
View Code

安装Maven

编译要求:Maven 3.0 or later
安装软件:apache-maven-3.0.5-bin.tar.gz

1
2
3
4
[root@hadoop1 soft]# ls
apache-maven-3.3.9-bin.tar.gz
[root@hadoop1 soft]# chmod 755 apache-maven-3.3.9-bin.tar.gz
[root@hadoop1 soft]# tar -zxvf apache-maven-3.3.9-bin.tar.gz <br>。。。<br>[root@hadoop1 soft]# mv apache-maven-3.3.9 /opt/<br>[root@hadoop1 soft]# vi /etc/profile

配置mvn的环境变量

export M2_HOME=/opt/apache-maven-3.3.
export PATH=$PATH:$M2_HOME/bin

测试

[root@hadoop1 soft]# mvn -vApache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)Maven home: /opt/apache-maven-3.3.9Java version: 1.8.0_73, vendor: Oracle CorporationJava home: /usr/local/jdk1.8.0_73/jreDefault locale: zh_CN, platform encoding: UTF-8OS name: "linux", version: "2.6.32-573.el6.x86_64", arch: "amd64", family: "unix"[root@hadoop1 soft]# 

 

安装Findbugs

编译要求:Findbugs 1.3.9 
安装软件:findbugs-3.0.1.tar.gz

[root@hadoop1 soft]# lsfindbugs-3.0.1.tar.gz[root@hadoop1 soft]# chmod 755 findbugs-3.0.1.tar.gz [root@hadoop1 soft]# tar -zxvf findbugs-3.0.1.tar.gz -C /opt

 配置Findbugs环境变量

[root@hadoop1 soft]# vi /etc/profile

export FINDBUGS_HOME=/opt/findbugs-3.0.1
export PATH=$PATH:$FINDBUGS_HOME/bin

测试

[root@hadoop1 soft]# findbugs -version3.0.1[root@hadoop1 soft]# 

 

安装ProtocolBuffer

编译要求:ProtocolBuffer 2.5.0 
安装软件:protobuf-2.5.0.tar.gz,不建议用其它版本

[root@hadoop1 soft]# lsprotobuf-2.5.0.tar.gz[root@hadoop1 soft]# chmod 755 protobuf-2.5.0.tar.gz [root@hadoop1 soft]# tar -zxvf protobuf-2.5.0.tar.gz -C /opt
[root@hadoop1 soft]# cd /opt/protobuf-2.5.0/
[root@hadoop1 protobuf-2.5.0]# ./configure 
[root@hadoop1 protobuf-2.5.0]# make
[root@hadoop1 protobuf-2.5.0]# make install

测试

[root@hadoop1 protobuf-2.5.0]# protoc --versionlibprotoc 2.5.0[root@hadoop1 protobuf-2.5.0]# 

 

修改maven的配置文件,添加maven的下载源

[root@hadoop1 protobuf-2.5.0]# cd /opt/apache-maven-3.3.9/conf/
[root@hadoop1 conf]# vi settings.xml

在mirrors中添加alimaven的下载源

<mirrors>    <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |            <mirror>        <id>alimaven</id>        <mirrorOf>central</mirrorOf>         <name>aliyun maven</name>        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>        </mirror>        <mirror>        <id>mirrorId</id>        <mirrorOf>repositoryId</mirrorOf>        <name>Human Readable Name for this Mirror.</name>        <url>http://my.repository.com/repo/path</url>        </mirror>     --></mirrors>

安装Ant

[root@hadoop1 soft]# lsapache-ant-1.9.4-bin.tar.gz  hadoop-2.7.5-src[root@hadoop1 soft]# tar -zxvf apache-ant-1.9.4-bin.tar.gz -C /opt/

配置环境变量

[root@hadoop1 apache-ant-1.9.4]# vi /etc/profile
#Antexport ANT_HOME=/opt/apache-ant-1.9.4export PATH=$PATH:$ANT_HOME/bin

检测

[root@hadoop1 apache-ant-1.9.4]# ant -versionApache Ant(TM) version 1.9.4 compiled on April 29 2014[root@hadoop1 apache-ant-1.9.4]# 

安装Snappy

解压

[root@hadoop1 soft]# lshadoop-2.7.5-src  snappy-1.1.1.tar.gz[root@hadoop1 soft]# tar -zxvf snappy-1.1.1.tar.gz -C /opt/

安装

[root@hadoop1 soft]# cd /opt/snappy-1.1.1/[root@hadoop1 snappy-1.1.1]# ./configure [root@hadoop1 snappy-1.1.1]# make [root@hadoop1 snappy-1.1.1]# make install

查看snappy文件库

[root@hadoop1 snappy-1.1.1]# ls -lh /usr/local/lib | grep snappy-rw-r--r--  1 root root 228K 3月   3 09:51 libsnappy.a-rwxr-xr-x  1 root root  953 3月   3 09:51 libsnappy.lalrwxrwxrwx  1 root root   18 3月   3 09:51 libsnappy.so -> libsnappy.so.1.2.0lrwxrwxrwx  1 root root   18 3月   3 09:51 libsnappy.so.1 -> libsnappy.so.1.2.0-rwxr-xr-x  1 root root 145K 3月   3 09:51 libsnappy.so.1.2.0[root@hadoop1 snappy-1.1.1]# 

开始编译hadoop

[root@hadoop1 soft]# ls[root@hadoop1 soft]# tar -zxvf hadoop-2.7.5-src.tar.gz 

在编译之前防止java.lang.OutOfMemoryError:Java heap space堆栈问题,在centos系统中执行命令

[root@hadoop1 snappy-1.1.1]# export MAVEN_OPTS="-Xms256m -Xmx512m"

进入源码包下,执行命令进行编译

[root@hadoop1 snappy-1.1.1]# cd /soft/hadoop-2.7.5-src/[root@hadoop1 hadoop-2.7.5-src]# mvn package -Pdist,native,docs -DskipTests -Dtar

 如果中途编译失败,并且不要文档的话,请使用这个命令:

[root@master ~]# mvn clear package -Pdist,native -DskipTests -Dtar -Dsnappy.lib=/usr/local/lib -Dbundle.snappy -Drequire.openssl

 

编译成功之后,hadoop-2.7.5.tar.gz位于/soft/hadoop-2.7.5-src/hadoop-dist/target目录下,这是编译后文件夹的状态

至此,大功告成!!!

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Hbase支持snappy压缩格式
CentOS 编译Hadoop 2.6 32位
基于Hadoop生态SparkStreaming的大数据实时流处理平台的搭建
hadoop2.2.0在centos6.5 64位系统上编译
ONOS源码安装及部署 | SDNLAB | 专注网络创新技术
Maven和 Sonatype Nexus私服的安装、配置及使用入门
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服