编译安装hadoop2.6

准备:

1.安装gcc

yum install gcc

yum install gcc-c++

2.安装jdk(注意必须jdk,jre不行)

3.ProtocolBuffer 2.5.0

wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2

tar jxvf protobuf-2.5.0.tar.bz2

cd protobuf-2.5.0.tar.bz2

./configure --prefix=/usr/local/protobuf-2.5.0

make

make install

配置环境变量

export PATH=$PATH:/usr/local/protobuf-2.5.0/bin/
export PKG_CONFIG_PATH=/usr/local/protobuf-2.5.0/lib/pkgconfig/

source /etc/profile

检验是否安装成功:

protoc –version

4. Maven

yum install maven

环境变量:

export MAVEN_HOME=/usr/local/apache-maven-3.2.5

source /etc/profile

检验是否安装成功:

mvn -version

5.CMake

yum install ncurses-devel

yum install openssl-devel

(不装上面这两个编译时pipe会过不去)

yum install cmake

6.Autotools

(如果编译 native code需要)

sudo yum install autoconf automake libtool

7.Forrest

(Apache Forrest是一个平台独立的文档框架。把来自各种不同的输入数据源转换成用一种或多种输出格式(比如HTML,PDF等)来统一显示的发布系统。它基 于Apache Cocoon并分离了内容与内容结构,不仅可以生成静态的文档也可以当作一个动态的服务器。如果要生成文档则需要。)

wget mirrors.cnnic.cn/apache//forrest/apache-forrest-0.9-sources.tar.gz

wget mirrors.cnnic.cn/apache//forrest/apache-forrest-0.9-dependencies.tar.gz

解压apache-forrest-0.9-sources.tar.gz

tar -zxvf apache-forrest-0.9-sources.tar.gz

解压apache-forrest-0.9-dependencies.tar.gz到forrest

tar -zxvf apache-forrest-0.9-dependencies.tar.gz

 

cd /usr/local/apache-forrest-0.9/main

./build

配置环境变量

export FORREST_HOME=/usr/local/apache-forrest-0.9
export PATH=$PATH:$FORREST_HOME/bin

 

8. ant

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:
[ERROR] around Ant part ...<exec dir="/home/hadoop/hadoop-2.6.0-src/hadoop-commo-src/hadoop-common-project/hadoop-common/target/antrun/build-main.xml

安装ant

wget archive.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz

解压到/usr/local/

tar -zvxf apache-ant-1.9.4-bin.tar.gz

注意:备份 /etc/ant.conf

卸掉系统里的ant yum remove ant,卸掉之后conf文件也会消失

 

ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014

若出现这样的错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
这是系统中路径不对, 改/etc/ant.conf中ANT_HOME=/usr/share/ant 为你正确安装ant地址,如:

的地址,如ANT_HOME=/usr/local/apache-ant-1.9.4

 

9.安装findbugs

wget http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.tar.gz/download?use_mirror=hivelocity&download=

wget http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-noUpdateChecks-3.0.0.tar.gz/download?use_mirror=superb-dca3&download=

 

tar -zvxf findbugs-3.0.0.tar.gz

tar -zxvf findbugs-noUpdateChecks-3.0.0.tar.gz

 

配置环境变量

export FINDBUGS_HOME=/usr/local/findbugs-2.0.3
export PATH=$PATH:$FINDBUGS_HOME/bin 

检验:

 

findbugs -version

3.0.0

 

10.

下载编译hadoop

wget http://mirrors.cnnic.cn/apache/hadoop/common/hadoop-2.6.0/hadoop-2.6.0-src.tar.gz

tar -zxvf hadoop-2.6.0-src.tar.gz

cd hadoop-2.6.0-src

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

 

编译后路径:

/home/hadoop/hadoop-2.6.0-src/hadoop-dist/target/hadoop-2.6.0.tar.gz

 

 

 

你可能感兴趣的:(hadoop2)