Linux系统下Hadoop2.6版本编译

花了5个小时终于将Hadoop2.6版本成功编译过了,过程中遇到的最多的就是编译环境的版本问题,话不多说,以下是我的编译步骤:

1.准备环境:

1.1 安装gcc yum install gcc yum install gcc-c++

1.2 安装jdk(注意必须jdk,jre不行),版本最好是jdk1.7,否则后边编译会报错

1.3ProtocolBuffer 2.5.0,之前的版本不能成功编译,ProtobolBuf下载地址

编译步骤:
(1) cd protobuf-2.5.0.tar.bz2 

(2) ./configure

(3) make 

(4) sudo make install

(5) ldconfig    (很多文章都没有这步,如果不执行会出错)

环境变量:

(1)在/etc/profile中添加下面一行代码:                 

export LD_LIBRARY_PATH=/home/wanghy/work/learning/protobuf-2.5.0

(2)执行一次:source /etc/profile

检验是否安装成功:

   protoc –version

1.4 Maven 最好是最新版本,2.x版本不能编译,Maven下载地址

编译步骤:

  (1) tar zxf apache-maven-3.3.1-bin.tar.gz

  (2) mv zxf apache-maven-3.3.1-bin /usr/bin/mvn

环境变量:

  (1) 在/etc/profile中添加下面代码

                    export MAVEN_HOME=/usr/bin/mvn
                    export PATH=$PATH:$MAVEN_HOME/bin
      (2) source /etc/profile

    测试是否配置成功:

       mvn -version

   修改配置文件vi /usr/bin/mvn/conf/settings.xml

   (1) 在<profiles></profiles>中添加下面代码

<profiles>
     <id>jdk-1.7</id>
     <activation>
         <jdk>1.7</jdk>
     </activation>
     <repositories>
         <repository>
              <id>nexus</id>
              <name>local private nexus</name>
              <url>http://maven.oschina.net/content/groups/public/</url>
              <releases>
                 <enabled>true</enabled>
              </releases>
              <snapshots>
                 <enabled>false</enabled>
              </snapshots>
        </repository>
   </repositories>
       <pluginRepositories>
         <pluginRepository>
           <id>nexus</id>
           <name>local private nexus</name>
           <url>http://maven.oschina.net/content/groups/public/</url>
           <releases>
             <enabled>true</enabled>
           </releases>
           <snapshots>
             <enabled>false</enabled>
           </snapshots>
         </pluginRepository>
       </pluginRepositories>
</profiles>
 
   (2) 
在<mirrors></mirrors>中添加下面代码 
<mirrors>
     <id>nexus-osc</id>
     <mirrorOf>*</mirrorOf>
     <name>Nexusosc</name>
     <url>http://maven.oschina.net/content/groups/public/</url>
</mirrors>
 

1.5安装ant  对版本没有要求


2 编译Hadoop2.6:

         (1) cd /hadoop/hadoop-2.6.0-src

         (2) mvn clean

         (3) mvn package -Pdist,native -DskipTests -Dtar  -e

3 编译结果:

                           

  可以看到hadoop-dist目录下生成了target目录和一些文件,代表编译成功。 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值