CentOS6.4编译Hadoop-2.4.0

因为搭建Hadoop环境的时候,所用的系统镜像是emi-centos-6.4-x86_64,是64位的,而hadoop是默认是32的安装包。这导致我们很多操作都会遇到这个问题(Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /opt/hadoop-2.4.0/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.)

为了解决此问题,需要重新编译hadoop。把生成的 hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0/lib/native 覆盖到 /opt/hadoop-2.4.0/lib/native。

以下是具体的编译步骤:

1. 安装下面的软件

[[email protected] software]# yum install lzo-devel zlib-devel gcc autoconf automake libtool ncurses-devel openssl-deve

2. 安装Maven

[[email protected] software]$ wget http://mirror.esocc.com/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
[[email protected] software]$ tar zxf apache-maven-3.0.5-bin.tar.gz -C /opt

[[email protected] software]$ vi /etc/profile
export MAVEN_HOME=/opt/apache-maven-3.0.5
export PATH=$PATH:$MAVEN_HOME/bin

3. 安装Ant

[[email protected] software]$ wget http://mirror.bit.edu.cn/apache/ant/binaries/apache-ant-1.9.4-bin.tar.gz
[[email protected] software]$ tar zxf apache-ant-1.9.4-bin.tar.gz -C /opt

[[email protected] software]$ vi /etc/profile
export ANT_HOME=/opt/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin

4. 安装Findbugs

[[email protected] software]$ wget http://prdownloads.sourceforge.net/findbugs/findbugs-2.0.3.tar.gz?download
[[email protected] software]$ tar zxf findbugs-2.0.3.tar.gz -C /opt

[[email protected] software]$ vi /etc/profile
export FINDBUGS_HOME=/opt/findbugs-2.0.3
export PATH=$PATH:$FINDBUGS_HOME/bin

5. 安装protobuf

[[email protected] software]$ tar zxf protobuf-2.5.0.tar.gz
[[email protected] software]$ cd protobuf-2.5.0
[[email protected] software]$ ./configure
[[email protected] software]$ make
[[email protected] software]$ make install

说实话,上面这种编译、安装方式挺麻烦的。很容易碰到各种依赖问题。这里推荐用yum install来安装。

[[email protected] protobuf-2.5.0]# yum install protobuf

6. 编译Hadoop

1) 在name节点上先编译hadoop

[[email protected] software]$ wget http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.4.0/hadoop-2.4.0-src.tar.gz
[[email protected] software]$ cd hadoop-2.4.0-src

[[email protected] software]$ mvn package -DskipTests -Pdist,native -Dtar

中间过程出错了,错误信息如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (make) on project hadoop-common: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in directory "/home/hxiaolong/software/hadoop-2.4.0-src/hadoop-common-project/hadoop-common/target/native"): error=2, No such file or directory
[ERROR] around Ant part ...<exec dir="/home/hxiaolong/software/hadoop-2.4.0-src/hadoop-common-project/hadoop-common/target/native" executable="cmake" failonerror="true">... @ 4:145 in /home/hxiaolong/software/hadoop-2.4.0-src/hadoop-common-project/hadoop-common/target/antrun/build-main.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :hadoop-common

网上看了下,是因为cmake没安装引起的。安装一下再试。

[[email protected] hadoop-2.4.0-src]# yum instsall cmake

重新编译,最终成功了。

[[email protected] software]$ mvn package -DskipTests -Pdist,native -Dtar

main:
     [exec] $ tar cf hadoop-2.4.0.tar hadoop-2.4.0
     [exec] $ gzip -f hadoop-2.4.0.tar
     [exec]
     [exec] Hadoop dist tar available at: /home/hxiaolong/software/hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0.tar.gz

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:41.833s
[INFO] Finished at: Wed Jul 23 03:01:18 UTC 2014
[INFO] Final Memory: 159M/646M
[INFO] ------------------------------------------------------------------------

2) 把编译后的hadoop的native目录copy到/opt/hadoop-2.4.0/lib/

[[email protected] lib]$ rm -rf /opt/hadoop-2.4.0/lib/native
[[email protected] lib]$ cp -R /home/hxiaolong/software/hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0/lib/native /opt/hadoop-2.4.0/lib/

这是非常重要的一个步骤。

3) 把编译后的hadoop的native目录scp其它节点

[[email protected] lib]# scp -r /home/hxiaolong/software/hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0/lib/native/ hd2:/opt/hadoop-2.4.0/lib/
[[email protected] lib]# scp -r /home/hxiaolong/software/hadoop-2.4.0-src/hadoop-dist/target/hadoop-2.4.0/lib/native/ hd3:/opt/hadoop-2.4.0/lib/

如果不把重新编译过后的native目录同步到其它节点,那在其它节点也会遇到同样的问题。

4) 验证

[[email protected] native]$ hadoop fs -ls /
Found 1 items
drwxr-xr-x   - hxiaolong supergroup          0 2014-07-23 05:21 /input

OK了,不会报错了。

今天偶然发现这个镜像mirror.bit.edu.cn还蛮快的,而且比较稳定。看了下,是北理的。赞一个~

CentOS6.4编译Hadoop-2.4.0,布布扣,bubuko.com

时间: 2024-10-10 02:05:03

CentOS6.4编译Hadoop-2.4.0的相关文章

CentOS 6.4 64位 源码编译hadoop 2.2.0

CentOS 6.4 64位 源码编译hadoop 2.2.0 搭建环境:Centos 6.4 64bit 1.安装JDK 参考这里2.安装mavenmaven官方下载地址,可以选择源码编码安装,这里就直接下载编译好的wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip解压文件后,同样在/etc/profie里配置环境变量vim /etc/profieexport

64位centos 下编译 hadoop 2.6.0 源码

64位os下为啥要编译hadoop就不解释了,百度一下就能知道原因,下面是步骤: 前提:编译源码所在的机器,必须能上网,否则建议不要尝试了 一. 下载必要的组件 a) 下载hadoop源码 (当前最新的稳定版是2.6.0)地址  http://mirrors.hust.edu.cn/apache/hadoop/common/stable/hadoop-2.6.0-src.tar.gz b) 下载apache-ant (centos自带的ant版本太低,编译过程中会报错)地址: http://mi

CentOS 64位上编译 Hadoop 2.6.0

1.操作系统编译环境 yum install cmake lzo-devel zlib-devel gcc gcc-c++ autoconf automake libtool ncurses-devel openssl-devel libXtst 2.安装JDK 下载JDK1.7,注意只能用1.7,否则编译会出错 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html tar zxvf

64位CentOS上编译 Hadoop 2.2.0

1. 下载Hadoop 2.2.0 源码包,并解压 $ wget http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz $ tar zxf hadoop-2.2.0-src.tar.gz 2. 安装下面的软件 $ sudo yum install cmake lzo-devel zlib-devel gcc autoconf automake libtool ncurses-dev

HBASE 0.98版本安装,一步曲:编译HADOOP 2.2.0 x64版本

1.安装JDK 下载JDK 7u55版本,安装JDK和JRE都需要,JDK里面有tools.jar,这个jar包是一定需要的安装在/java上 2.下载Hadoop 2.2.0源代码 wget http://apache.dataguru.cn/hadoop/common/stable/hadoop-2.2.0-src.tar.gz解压缩tar zxvf hadoop-2.2.0-src.tar.gz -C /tmp 3.安装依赖包 yum -y install lzo-devel zlib-d

Mac OS X 10.10编译Hadoop 2.6.0笔记

原本通过brew 安装了Hadoop 2.6.0,但是使用过程中报一个错误(错误描述),查了资料说是因为native库的问题,看了一下,发现通过brew安装的版本根本就没有native目录,所以下载了源码自己编译.结果陆续出了不少问题,记录如下: 1.错误: 程序包com.sun.javadoc不存在 这个错误尝试了很多方法,包括在pom.xml中指定tools.jar文件等等 最后通过'export JAVA_HOME=/usr/libexec/java_home -v 1.6'命令切换JDK

Centos 6.5 X64 环境下编译 hadoop 2.6.0 --已验证

Centos 6.5 x64 hadoop 2.6.0 jdk 1.7 protobuf-2.5.0 maven-3.0.5 set environment export JAVA_HOME=/home/linux/jdk export CLASSPATH=JAVA_HOME/lib/tools.jar export PROTOC_HOME=/home/linux/protobuf export MAVEN_HOME=/home/linux/maven export PATH=$PROTOC_H

CentOS6上编译安装ZABBIX 3.0

0x00  实验环境 系统:CentOS-6.8-x86_64 httpd:2.4.20 mysql:5.6.31 php:5.6.22 IP:10.0.0.4 0x01  编译安装zabbix3.0 1.下载zabbix源码包 [[email protected] src]# cd /usr/local/src/ [[email protected] src]# wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Late

ubuntu 环境下编译 hadoop 2.6.0的简单方法

由于服务器一般都64位系统, hadoop网站的release版本32位native库不能运行,所以需要自己在编译一下.以下是我采用的一个编译的过程,比较简单,不用下载各种版本及环境配置,通过命令就能自动完成了.系统环境为ubuntu server 64位版. 1.安装JDK,我这里使用的是OenJDK sudo apt-get install default-jdk java -version 显示版本信息: java version "1.7.0_65" OpenJDK Runti

CentOS6.6编译安装GCC-5.2.0

Linux下编写C/C++程序自然缺不了一个优秀的编译器,Linux下比较常见的自然是GCC了. 2015年GCC也出到了5.2.0版本,对于C++11/14也有了更好的支持了. 所以,今天我们就来说说GCC的编译安装,安装的版本正是最新的5.2.0. 下面我们进入正题(建议整个过程以root用户进行): 1.下载GCC源码: wget ftp://mirrors.kernel.org/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.gz 2.解压: tar -zxvf gcc-