1.Unix系统
2.JDK1.7_25
3.Maven3.0.5
4.Findbugs2.0.2(若运行Findbugs)
5.ProtocolBuffer2.5.0
6.CMake2.6或更高版本(若编译native库)
1.下载地址
http://maven.apache.org/download.cgi
2.安装及配置
1)解压安装包
[root@xxx ~]# tar -zxvf'/usr/maven3.0.5/apache-maven-3.0.5-bin.tar.gz' -C '/usr/maven3.0.5'
2)配置环境变量
[root@xxx ~]# vim /etc/profile
修改并保存:
#set maven path
export M2_HOME=/usr/maven3.0.5/apache-maven-3.0.5
export PATH=$PATH:$M2_HOME/bin
3)编译配置文件
[root@xxx~]# source /etc/profile
4)查看maven版本
[root@Slave01 hadoop]# mvn -v
Apache Maven 3.0.5(r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /usr/maven3.0.5/apache-maven-3.0.5
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_25/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version:"2.6.32-358.el6.x86_64", arch: "amd64", family:"unix"
1.下载地址
http://sourceforge.jp/projects/sfnet_findbugs/downloads/findbugs/2.0.2/findbugs-2.0.2.tar.gz/
2.安装及配置
1)解压安装包
[root@xxx ~]# tar -zxvf ‘xxxx’ -C '/usr/findbugs'
2)配置环境变量
[root@xxx ~]# vim /etc/profile
修改并保存:
# set findbugs path
export FINDBUGS_HOME=/usr/findbugs/findbugs-2.0.2
export PATH=$PATH:$FINDBUGS_HOME/bin
3)编译配置文件
[root@xxx~]# source /etc/profile
1.下载地址
http://code.google.com/p/protobuf/downloads/list
2.安装及配置
1)解压安装包
[root@xxx ~]# tar -zxvf ‘xxxx’ -C '/usr/protocolBuffer'
2)安装
进入安装目录
[root@xxx ~]# cd /usr/protocolBuffer/protobuf-2.5.0
[root@xxx ~]# ./configure
[root@xxx ~]# make
[root@xxx ~]# make install
3)查看protocolBuffer版本
[root@Slave01 protobuf-2.5.0]# protoc --version
libprotoc 2.5.0
1.下载地址
http://wwwNaNake.org/cmake/resources/software.html
2.安装及配置
1)解压安装包
[root@xxx ~]# mkdir /usr/cmake2.8
[root@xxx ~]# tar -zxvf'/usr/cmake2.8/cmake-2.8.11.2.tar.gz' -C '/usr/cmake2.8'
2)安装
[root@xxx ~]# yum list|grep gcc
[root@xxx ~]# cd '/usr/cmake2.8/cmake-2.8.11.2'
[root@xxx cmake-2.8.11.2]# ./bootstrap
[root@xxx cmake-2.8.11.2]# make
[root@xxx cmake-2.8.11.2]# make install
Linux系统已安装了SVN,所以可以直接checkout,命令如下:
1.建立checkout后的存放目录
[root@xxx ~]# mkdir /usr/hadoop
2.Checkout源码
[root@xxx ~]# cd '/usr/hadoop'
[root@xxx ~]# svn checkout http://svn.apache.org/xxxxx
注:svn checkoutpath(path是服务器上的目录,源码所在URL)
例如:svn checkout svn://192.168.1.1/pro/domain
Linux命令详解,请查看博客:
http://www.cnblogs.com/xulb597/archive/2012/07/02/2573575.html
1.编译
[root@xxx ~]# mvn package -Pdist,native,docs-DskipTests –Dtar
具体可以查看checkout出的hadoop文件夹中BUILDING.txt
附:
Building distributions:
Create binary distribution without native code andwithout documentation:
$ mvn package-Pdist -DskipTests -Dtar
Create binary distribution with native code and withdocumentation:
$ mvnpackage -Pdist,native,docs -DskipTests -Dtar
Create source distribution:
$ mvnpackage -Psrc -DskipTests
Create source and binary distributions with nativecode and documentation:
$ mvnpackage -Pdist,native,docs,src -DskipTests -Dtar
Create a local staging version of the website (in/tmp/hadoop-site)
$ mvn cleansite; mvn site:stage -DstagingDirectory=/tmp/hadoop-site
2.编译成功后,命令行出现类似以下的结果
[INFO] BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO] Total time: 22:27.581s
[INFO] Finished at: Mon Sep 16 23:25:03 CST 2013
[INFO] Final Memory: 132M/498M
[INFO]------------------------------------------------------------------------
3.编译成功后的jar包
编译成功后,在hadoop-dist目录下出现一个文件夹target,可以查看这个文件夹下内容
[root@xxx hadoop-dist]# ls
pom.xml target
[root@xxx hadoop-dist]# cd target
[root@xxx target]# ls
antrun hadoop-dist-2.1.1-SNAPSHOT.jar
dist-layout-stitching.sh hadoop-dist-2.1.1-SNAPSHOT-javadoc.jar
dist-tar-stitching.sh javadoc-bundle-options
hadoop-2.1.1-SNAPSHOT maven-archiver
hadoop-2.1.1-SNAPSHOT.tar.gz test-dir
其中,hadoop-2.1.1-SNAPSHOT.tar.gz就是部署hadoop集群式要用到的jar包和脚本所在地,和从hadoop.apache.org中download下来的安装包是基本一样的。
至此,我们可以用自己编译出的安装包来进行hadoop的集群安装。