hadoop2.7.2编译

----------------------------------------------------------------------------------
Requirements:

* Unix System
* JDK 1.7+
* 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), must be 3.0 or newer on Mac
* 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)

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

----------------------------------------------------------------------------------
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

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

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

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"

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


1.上传hadoop-2.7.2-src.tar.gz到服务器/usr/hadoop目录下
解压:tar zxvf hadoop-2.7.2-src.tar.gz

安装jdk
1)上传tar包到服务器
2)解压到目录
3)配置环境变量
1.打开文件 vim /etc/profile
2.export JAVA_HOME=/usr/jdk目录/jdk8加压后得到的目录名
  export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  export PATH=$PATH:$JAVA_HOME/bin
4.刷新profile文件 命令:source /etc/profile
5.测试jdk的安装 java -version和javac

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

2.安装各种库,
yum -y install svn ncurses-devel gcc*
yum -y install lzo-devel zlib-devel autoconf automake libtool cmake openssl-devel
----------------------------------------------------------------------------------

3.安装protobuf-2.5.0.tar.gz(注意版本必须是2.5.0 Requirements有说明)
下载上传
tar zxvf protobuf-2.5.0.tar.gz
进入protobuf-2.5.0依次执行
cd protobuf-2.5.0
./configure
make && make install
验证安装是否完成
protoc --version
----------------------------------------------------------------------------------

4.安装maven
下载apache- maven- 3.3.9- bin.tar.gz
解压缩并配置环境变量
解压:
tar -zxvf apache-maven-3.3.9-bin.tar.gz
配置环境变量:
vim /etc/profile
在末尾添加:
export MAVEN_HOME=/usr/modules/apache-maven-3.3.9
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
mvn -version
更改为国内的源:
vim ../../conf/setting.xml
<mirrors>
    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
</mirrors>


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


5.安装ant
下载apache-ant-1.9.7-bin.tar.gz
解压缩并配置环境变量
解压:
tar -zxvf apache-ant-1.9.7-bin.tar.gz
配置环境变量
同上,在/etc/profile文件末未添加:
export ANT_HOME=/usr/modules/apache-ant-1.9.7
export PATH=$PATH:$ANT_HOME/bin
然后保存,退出,并使更改生效。
查看安装结果:
ant -version
----------------------------------------------------------------------------------


6.安装findbugs
下载findbugs-3.0.1.tar.gz,选择上面的standard version即可
解压缩并配置环境变量
解压:
tar -zxvf findbugs-3.0.1.tar.gz
配置环境变量:
在 /etc/profile 文件末尾添加:
export FINDBUGS_HOME=/usr/modules/findbugs-3.0.1
export PATH=$PATH:$FINDBUGS_HOME/bin
保存退出,并使更改生效。
查看安装结果
findbugs -version

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

7.准备完成,下面开始编译hadoop
进入到hadoop-2.7.2-src目录
使用命令:
mvn clean package –Pdist,native –DskipTests –Dtar
或者:
mvn package -Pdist,native -DskipTests -Dtar
进行编译。  
务必保持网络畅通,最好更改为国内的maven源!
Total time: 51:13 min

编译好的文件在/hadoop-dist/target/hadoop-2.7.2.tar.gz下。


注意事项:
1.所有命令,建议手敲,不建议复制粘贴,以避免因为页面空格造成的不必要错误。
2.务必保持网络畅通,如果出现缺少某个文件,则要先清理maven(使用命令 mvn clean) 再重新编译。
3.如果总是出现同一个错误导致编译失败,则可能是缺少某个库或者工具,检查上述工具是否都安装成功,并且版本正确。

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











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值