> Linux集群 > Hadoop >

Centos6.5编译Hadoop2.4源码

今天来说说编译hadoop源码的事情吧~

1、首先下载源码

地址:http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.4.0/

\

2、加压tar包到指定文件夹:/home/hadoop/soft/hadoop

 

view sourceprint?
1.tar zxvf hadoop-2.4.0-src.tar.gz

3、Linux编译环境准备

 

 

java环境准备 参照:http://blog.csdn.net/enson16855/article/details/8708574 maven环境 下载地址:http://maven.apache.org/download.cgi \
解压到指定文件夹:/home/hadoop/soft/ 配置maven本地仓库,编辑maven下 conf/settings.xml文件
view sourceprint?
1.<localRepository>/home/hadoop/soft/repo</localRepository>

\
ant环境 下载地址:http://ant.apache.org/bindownload.cgi 
\

以上maven,JDK,ant的配置如下: root用户下面编辑/etc/profile 命令如下:
view sourceprint?
1.vim /etc/profile
在此文件最后面加上以下内容
view sourceprint?
01.export JAVA_HOME=/usr/java/jdk1.7.0_60
02.export PATH="$JAVA_HOME/bin:$PATH"
03. 
04.export MAVEN_HOME=/home/hadoop/soft/apache-maven-3.2.1
05.export PATH="$MAVEN_HOME/bin:$PATH"
06. 
07.export ANT_HOME=/home/hadoop/soft/apache-ant-1.9.4
08.export PATH="$ANT_HOME/bin:$PATH"
09. 
10.export HADOOP_PREFIX=/home/hadoop/soft/hadoop/hadoop-2.4.0
11.export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"
12.export PATH="$JAVA_HOME/:$HADOOP_PREFIX/bin:$PATH"
13.export HADOOP_PREFIX PATH CLASSPATH
openssl库的安装
采用yum方式安装,yum配置参照:http://blog.csdn.net/enson16855/article/details/9140623 命令如下:root用户哦~
view sourceprint?
1.yum install openssl
CMake安装
与openssl的安装一样,采用yum安装:
view sourceprint?
1.yum install cmake
protobuf的安装
下载:
view sourceprint?
1.wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz

下载完成解压:
view sourceprint?
1.tar zxvf protobuf-2.5.0.tar.gz
进入解压的文件夹中,执行以下命令:
view sourceprint?
1.sudo ./configure
2.sudo make
3.sudo make check
4.sudo make install
5.sudo ldconfig
验证: \ 4、编译hadoop2.4源码 执行以下命令:
view sourceprint?
1.mvn package -Pdist,native -DskipTests -Dtar

\ 
进到~/hadoop-2.4.0-src/hadoop-dist/target文件夹中有: 

 
(责任编辑:IT)