Build instructions for Hadoop (Hadoop 编译安装,参考hadoop源码包中BUILDING.txt文档)

----------------------------------------------------------------------------------
Requirements(编译需求,需要满足以下条件才能编译成功):

* Unix System
* JDK 1.6+
* 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)
* Zlib devel (if compiling native code)
* openssl devel ( if compiling native hadoop-pipes )
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)

安装以上依赖条件:

yum groupinstall “Development tools”
yum -y install cmake zlib openssl gcc zlib-devel openssl-devel make

tar -zxvf protobuf-2.5.0.tar.gz
make && make install
protoc --version

安装maven(apache-maven-3.0.5-bin.zip)
解压、配置环境变量-略
[root@chavin ~]# mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /usr/local/maven305
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_67/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
配置软件库:
[root@chavin ~]# ll /home/hadoop/.m2/
total 16
drwxrwxr-x. 56 hadoop hadoop  4096 Mar  3 20:13 repository
-rw-r--r--.  1 hadoop hadoop 10224 Mar  3 20:13 settings.xml
其中repository通过tar包repository.tar.gz解压得到。

编译前安装findbugs
下载:findbugs-3.0.0.tar.gz
解压:
tar  -zxvf findbugs-3.0.0.tar.gz

设置环境变量:
export FINDBUGS_HOME = /usr/local/findbugs
export PATH=$PATH:$FINDBUGS_HOME/bin

执行命令:source /etc/profile或者 . /etc/profile
验证:findbugs -version

----------------------------------------------------------------------------------
编译选项:
Build options:

* Use -Pnative to compile/bundle native code
  * Use -Pdocs to generate & bundle the documentation in the distribution (using -Pdist)
  * Use -Psrc to create a project source TAR.GZ
  * Use -Dtar to create a TAR with the distribution (using -Pdist)

Snappy build options:

Snappy is a compression library that can be utilized by the native code.
   It is currently an optional component, meaning that Hadoop can be built with
   or without this dependency.

* Use -Drequire.snappy to fail the build if libsnappy.so is not found.
    If this option is not specified and the snappy library is missing,
    we silently build a version of libhadoop.so that cannot make use of snappy.
    This option is recommended if you plan on making use of snappy and want
    to get more repeatable builds.

* Use -Dsnappy.prefix to specify a nonstandard location for the libsnappy
    header files and library files. You do not need this option if you have
    installed snappy using a package manager.
  * Use -Dsnappy.lib to specify a nonstandard location for the libsnappy library
    files.  Similarly to snappy.prefix, you do not need this option if you have
    installed snappy using a package manager.
  * Use -Dbundle.snappy to copy the contents of the snappy.lib directory into
    the final tar file. This option requires that -Dsnappy.lib is also given,
    and it ignores the -Dsnappy.prefix option.

OpenSSL build options:

OpenSSL includes a crypto library that can be utilized by the native code.
   It is currently an optional component, meaning that Hadoop can be built with
   or without this dependency.

* Use -Drequire.openssl to fail the build if libcrypto.so is not found.
    If this option is not specified and the openssl library is missing,
    we silently build a version of libhadoop.so that cannot make use of
    openssl. This option is recommended if you plan on making use of openssl
    and want to get more repeatable builds.
  * Use -Dopenssl.prefix to specify a nonstandard location for the libcrypto
    header files and library files. You do not need this option if you have
    installed openssl using a package manager.
  * Use -Dopenssl.lib to specify a nonstandard location for the libcrypto library
    files. Similarly to openssl.prefix, you do not need this option if you have
    installed openssl using a package manager.
  * Use -Dbundle.openssl to copy the contents of the openssl.lib directory into
    the final tar file. This option requires that -Dopenssl.lib is also given,
    and it ignores the -Dopenssl.prefix option.

Tests options:

* Use -DskipTests to skip tests when running the following Maven goals:
    'package',  'install', 'deploy' or 'verify'
  * -Dtest=<TESTCLASSNAME>,<TESTCLASSNAME#METHODNAME>,....
  * -Dtest.exclude=<TESTCLASSNAME>
  * -Dtest.exclude.pattern=**/<TESTCLASSNAME1>.java,**/<TESTCLASSNAME2>.java
-------------------------------------------------------------------------------------
编译方法:
Building distributions:

Create binary distribution without native code and without documentation:

$ mvn package -Pdist -DskipTests -Dtar

Create binary distribution with native code and with documentation:

$ mvn package -Pdist,native,docs -DskipTests -Dtar

Create source distribution:

$ mvn package -Psrc -DskipTests

Create source and binary distributions with native code and documentation:

$ mvn package -Pdist,native,docs,src -DskipTests -Dtar

Create a local staging version of the website (in /tmp/hadoop-site)

$ mvn clean site; mvn site:stage -DstagingDirectory=/tmp/hadoop-site

----------------------------------------------------------------------------------

Handling out of memory errors in builds(编译过程中可能遇到的问题)

----------------------------------------------------------------------------------

If the build process fails with an out of memory error, you should be able to fix
it by increasing the memory used by maven -which can be done via the environment
variable MAVEN_OPTS.

Here is an example setting to allocate between 256 and 512 MB of heap space to
Maven

export MAVEN_OPTS="-Xms256m -Xmx512m"

----------------------------------------------------------------------------------

编译命令:mvn package -Pdist,native -DskipTests -Dtar

mvn package -DskipTests -Dtar -Dsnappy.lib=/usr/lib64/ -Dbundle.snappy

hadoop2.x编译安装的更多相关文章

  1. Hadoop第3周练习--Hadoop2.X编译安装和实验

    作业题目 位系统下进行本地编译的安装方式 选2 (1) 能否给web监控界面加上安全机制,怎样实现?抓图过程 (2)模拟namenode崩溃,例如将name目录的内容全部删除,然后通过secondar ...

  2. hadoop-2.2.0 的编译安装及HA配置

    一 准备工作 准备工作中要求有 1.centOs 6.4,添加hadoop用户,配置集群内的/etc/hosts文件. 2.安装hadoop用户的ssh,并打通集群内所有机器,(ha执行fencing ...

  3. hadoop2.1.0编译安装教程

    由于现在hadoop2.0还处于beta版本,在apache官方网站上发布的beta版本中只有编译好的32bit可用,如果你直接下载安装在64bit的linux系统的机器上,运行会报一个INFO ut ...

  4. hadoop2.1.0和hadoop2.2.0编译安装教程

    由于现在hadoop2.0还处于beta版本,在apache官方网站上发布的beta版本中只有编译好的32bit可用,如果你直接下载安装在64bit的linux系统的机器上,运行会报一个INFO ut ...

  5. hadoop2.2.0 centos 编译安装详解

    http://blog.csdn.net/w13770269691/article/details/16883663 废话不讲,直切正题. 搭建环境:Centos x 6.4 64bit 1.安装JD ...

  6. 编译安装hadoop2.6.3

    一.安装环境 1.1  JAVA  安装java1.7 下载jdk1.7: [root@node1~]# wget http://download.oracle.com/otn-pub/java/jd ...

  7. RedHat Ent 6.5 64bit编译安装hadoop2.4.1

    RedHat Ent 6.5 64bit编译安装hadoop2.4.1 感谢原帖:http://blog.csdn.net/w13770269691/article/details/16883663/ ...

  8. Apache Hadoop2.x 边安装边入门

    完整PDF版本:<Apache Hadoop2.x边安装边入门> 目录 第一部分:Linux环境安装 第一步.配置Vmware NAT网络 一. Vmware网络模式介绍 二. NAT模式 ...

  9. 附录A 编译安装Hadoop

    A.1  编译Hadoop A.1.1  搭建环境 第一步安装并设置maven 1.  下载maven安装包 建议安装3.0以上版本(由于Spark2.0编译要求Maven3.3.9及以上版本),本次 ...

随机推荐

  1. Git Step by Step – (6) Git远程仓库

    前面文章中出现的所有Git操作都是基于本地仓库的,但是日常工作中需要多人合作,不可能一直都在自己的代码仓库工作.所以,这里我们就开始介绍Git远程仓库. 在Git系统中,用户可以通过push/pull ...

  2. ajax简单手写了一个猜拳游戏

    使用ajax简单写一个猜拳游戏 HTML代码 <!DOCTYPE HTML> <html lang="en-US"> <head> <me ...

  3. jenkins构建的robot result结果不更新

    描述:构建的结果不进行更新,仍然显示以往的构建结果 定位原因:pybot 命令中生成的结果文件保存路径与构建后robot结果显示路径不一致所致 解决办法:修改二者的结果保存路径一致

  4. 使用taro开发钉钉的E应用报错 You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://git

    今天测试taro转钉钉E应用的时候,在模拟器上没事,但是在真机上却报错了: You are currently using minified code outside of NODE_ENV === ...

  5. linux C 调用shell程序执行

    #include<stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h ...

  6. Java枚举的小用法

    package com.lxc.wmb; public enum TestEnum { Success("200","成功!"), Faild("50 ...

  7. Subversion权限详解

    1   背景假设厦门央瞬公司是一家电子元器件设备供应商,其中有个ARM部门,专门负责ARM芯片的方案设计.销售,并在北京.上海各设立了一个办事处.对于工作日志,原先采用邮件方式发给经理,但是这种方式有 ...

  8. Android逆向笔记之AndroidKiller与Android Studio的使用

    https://blog.csdn.net/a_1054280044/article/details/60465267 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog. ...

  9. Matlab练习——多项式和一元方程求解

    1. 一元函数 f(x) = x^3 + (x - 0.98)^2 / (x + 1.25)^3 - 5 * (x + 1 / x),求f(x) = 0 的根 %在函数文件中定义函数 function ...

  10. <转>pandas学习

    1.Pandas 基本介绍 Numpy 和 Pandas 有什么不同? 如果用 python 的列表和字典来作比较, 那么可以说 Numpy 是列表形式的,没有数值标签,而 Pandas 就是字典形式 ...