CentOS 64位上编译 Hadoop2.6.0

简介: 由于hadoop-2.6.0.tar.gz安装包是在32位机器上编译的,64位的机器加载本地库.so文件时会出错,比如:java.lang.UnsatisfiedLinkError: org.

由于hadoop-2.6.0.tar.gz安装包是在32位机器上编译的,64位的机器加载本地库.so文件时会出错,比如:

java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCrc32.nativeComputeChunkedSumsByteArray(II[BI[BIILjava/lang/String;JZ)V 

所以需要重新编译


1.编译环境

yum install cmake lzo-devel zlib-devel gcc gcc-c++ autoconf automake libtool ncurses-devel openssl-devel libXtst

2.安装JDK(下载JDK1.7,只能用1.7,否则编译会出错)
下载页面:   http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

tar -zxvf jdk-7u75-linux-x64.tar.gz -C /usr/local

export JAVA_HOME=/usr/local/jdk1.7.0_75
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin

3.安装protobuf

下载protobuf-2.5.0,不能用高版本,否则Hadoop编译不能通过
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz    或者 在百度云盘上下载:http://yun.baidu.com/share/link?shareid=830873155&uk=3573928349

tar -zxvf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure
make
make install

protoc --version

4.安装ANT

wget http://mirror.bit.edu.cn/apache/ant/binaries/apache-ant-1.9.4-bin.tar.gz
 tar -zxvf apache-ant-1.9.4-bin.tar.gz -C /usr/local

vi /etc/profile
export ANT_HOME=/usr/local/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin

5.安装maven

wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz

tar -zxvf apache-maven-3.3.1-bin.tar.gz -C /usr/local

vi /etc/profile
export MAVEN_HOME=/usr/local/apache-maven-3.3.1
export PATH=$PATH:$MAVEN_HOME/bin

修改配置文件
vi /usr/local/apache-maven-3.3.1/conf/settings.xml

更改maven资料库,在<mirrors></mirros>里添加如下内容:

   <mirror>
        <id>nexus-osc</id>
         <mirrorOf>*</mirrorOf>
     <name>Nexusosc</name>
     <url>http://maven.oschina.net/content/groups/public/</url>
   </mirror>


在<profiles></profiles>内新添加

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


在shell下执行,使环境变量生效
source /etc/profile

7.编译 Hadoop2.6.0

wget http://mirror.bit.edu.cn/apache/hadoop/core/hadoop-2.6.0/hadoop-2.6.0-src.tar.gz
cd hadoop-2.6.0-src
mvn package -DskipTests -Pdist,native -Dtar

如果是第一次使用maven,会打印很多如下日志信息

Downloading: http://maven.oschina.net/...

Scanning for projects...

...

[INFO] Apache Hadoop Main ................................. SUCCESS [  4.590 s]
[INFO] Apache Hadoop Project POM .......................... SUCCESS [  3.503 s]
[INFO] Apache Hadoop Annotations .......................... SUCCESS [  5.870 s]
[INFO] Apache Hadoop Assemblies ........................... SUCCESS [  0.540 s]
[INFO] Apache Hadoop Project Dist POM ..................... SUCCESS [  3.921 s]
[INFO] Apache Hadoop Maven Plugins ........................ SUCCESS [  7.731 s]
[INFO] Apache Hadoop MiniKDC .............................. SUCCESS [  6.805 s]
[INFO] Apache Hadoop Auth ................................. SUCCESS [  9.008 s]
[INFO] Apache Hadoop Auth Examples ........................ SUCCESS [  6.991 s]
[INFO] Apache Hadoop Common ............................... SUCCESS [03:12 min]
[INFO] Apache Hadoop NFS .................................. SUCCESS [ 16.557 s]
[INFO] Apache Hadoop KMS .................................. SUCCESS [ 24.476 s]
[INFO] Apache Hadoop Common Project ....................... SUCCESS [  0.115 s]
[INFO] Apache Hadoop HDFS ................................. SUCCESS [05:09 min]
[INFO] Apache Hadoop HttpFS ............................... SUCCESS [ 40.145 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal .............. SUCCESS [ 15.876 s]
[INFO] Apache Hadoop HDFS-NFS ............................. SUCCESS [  9.236 s]
[INFO] Apache Hadoop HDFS Project ......................... SUCCESS [  0.125 s]
[INFO] hadoop-yarn ........................................ SUCCESS [  0.129 s]
[INFO] hadoop-yarn-api .................................... SUCCESS [02:49 min]
[INFO] hadoop-yarn-common ................................. SUCCESS [01:01 min]
[INFO] hadoop-yarn-server ................................. SUCCESS [  0.099 s]
[INFO] hadoop-yarn-server-common .......................... SUCCESS [ 25.019 s]
[INFO] hadoop-yarn-server-nodemanager ..................... SUCCESS [ 33.655 s]
[INFO] hadoop-yarn-server-web-proxy ....................... SUCCESS [  5.761 s]
[INFO] hadoop-yarn-server-applicationhistoryservice ....... SUCCESS [ 13.714 s]
[INFO] hadoop-yarn-server-resourcemanager ................. SUCCESS [ 41.930 s]
[INFO] hadoop-yarn-server-tests ........................... SUCCESS [ 13.364 s]
[INFO] hadoop-yarn-client ................................. SUCCESS [ 17.408 s]
[INFO] hadoop-yarn-applications ........................... SUCCESS [  0.042 s]
[INFO] hadoop-yarn-applications-distributedshell .......... SUCCESS [  5.131 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher ..... SUCCESS [  3.710 s]
[INFO] hadoop-yarn-site ................................... SUCCESS [  0.107 s]
[INFO] hadoop-yarn-registry ............................... SUCCESS [ 12.531 s]
[INFO] hadoop-yarn-project ................................ SUCCESS [  7.781 s]
[INFO] hadoop-mapreduce-client ............................ SUCCESS [  0.116 s]
[INFO] hadoop-mapreduce-client-core ....................... SUCCESS [ 47.915 s]
[INFO] hadoop-mapreduce-client-common ..................... SUCCESS [ 38.104 s]
[INFO] hadoop-mapreduce-client-shuffle .................... SUCCESS [  9.073 s]
[INFO] hadoop-mapreduce-client-app ........................ SUCCESS [01:01 min]
[INFO] hadoop-mapreduce-client-hs ......................... SUCCESS [ 18.149 s]
[INFO] hadoop-mapreduce-client-jobclient .................. SUCCESS [  9.002 s]
[INFO] hadoop-mapreduce-client-hs-plugins ................. SUCCESS [  3.222 s]
[INFO] Apache Hadoop MapReduce Examples ................... SUCCESS [ 13.224 s]
[INFO] hadoop-mapreduce ................................... SUCCESS [  6.571 s]
[INFO] Apache Hadoop MapReduce Streaming .................. SUCCESS [  9.781 s]
[INFO] Apache Hadoop Distributed Copy ..................... SUCCESS [ 16.254 s]
[INFO] Apache Hadoop Archives ............................. SUCCESS [  5.302 s]
[INFO] Apache Hadoop Rumen ................................ SUCCESS [ 13.760 s]
[INFO] Apache Hadoop Gridmix .............................. SUCCESS [  8.858 s]
[INFO] Apache Hadoop Data Join ............................ SUCCESS [  6.252 s]
[INFO] Apache Hadoop Ant Tasks ............................ SUCCESS [  4.276 s]
[INFO] Apache Hadoop Extras ............................... SUCCESS [  6.206 s]
[INFO] Apache Hadoop Pipes ................................ SUCCESS [  1.945 s]
[INFO] Apache Hadoop OpenStack support .................... SUCCESS [ 12.239 s]
[INFO] Apache Hadoop Amazon Web Services support .......... SUCCESS [ 38.137 s]
[INFO] Apache Hadoop Client ............................... SUCCESS [ 13.213 s]
[INFO] Apache Hadoop Mini-Cluster ......................... SUCCESS [  0.169 s]
[INFO] Apache Hadoop Scheduler Load Simulator ............. SUCCESS [ 13.206 s]
[INFO] Apache Hadoop Tools Dist ........................... SUCCESS [ 15.248 s]
[INFO] Apache Hadoop Tools ................................ SUCCESS [  0.162 s]
[INFO] Apache Hadoop Distribution ......................... SUCCESS [01:09 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25:19 min
[INFO] Finished at: 2015-03-26T17:54:10+08:00
[INFO] Final Memory: 106M/402M
[INFO] ------------------------------------------------------------------------


经过漫长的等待编译过程后,编译成功后会打包,放在hadoop-dist/target

#ll

total 528824
drwxr-xr-x 2 root root      4096 Mar 26 17:53 antrun
-rw-r--r-- 1 root root      1874 Mar 26 17:53 dist-layout-stitching.sh
-rw-r--r-- 1 root root       647 Mar 26 17:53 dist-tar-stitching.sh
drwxr-xr-x 9 root root      4096 Mar 26 17:53 hadoop-2.6.0
-rw-r--r-- 1 root root 180222548 Mar 26 17:53 hadoop-2.6.0.tar.gz
-rw-r--r-- 1 root root      2777 Mar 26 17:53 hadoop-dist-2.6.0.jar
-rw-r--r-- 1 root root 361254421 Mar 26 17:54 hadoop-dist-2.6.0-javadoc.jar
drwxr-xr-x 2 root root      4096 Mar 26 17:53 javadoc-bundle-options
drwxr-xr-x 2 root root      4096 Mar 26 17:53 maven-archiver
drwxr-xr-x 2 root root      4096 Mar 26 17:53 test-dir


编译后的文件见百度云盘

然后把lib下native下的文件覆盖掉hadoop下native中文件就ok了

目录
相关文章
|
7月前
|
应用服务中间件 Linux 网络安全
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
CentOS 7.4源码编译nginx1.12 并且隐藏nginx的版本
123 0
|
27天前
|
Linux 开发工具 Windows
CentOS8 64位系统 搭建内网穿透frp
【10月更文挑战第23天】本文介绍了如何在Linux系统上搭建frp内网穿透服务,并配置Windows客户端进行访问。首先,通过系统信息检查和软件下载,完成frp服务端的安装与配置。接着,在Windows客户端下载并配置frpc,实现通过域名访问内网地址。最后,通过创建systemd服务,实现frp服务的开机自动启动。
62 14
|
1月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。通过具体案例,读者可以了解如何准备环境、下载源码、编译安装、配置服务及登录 MySQL。编译源码安装虽然复杂,但提供了更高的定制性和灵活性,适用于需要高度定制的场景。
79 3
|
1月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。
本文介绍了在 CentOS 7 中通过编译源码安装 MySQL 数据库的详细步骤,并与使用 RPM 包安装进行了对比。内容涵盖准备工作、下载源码、编译安装、配置服务、登录设置及实践心得,帮助读者根据需求选择最适合的安装方法。
53 2
|
2月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置服务等,并与使用 RPM 包安装进行了对比,帮助读者根据需求选择合适的方法。编译源码安装虽然复杂,但提供了更高的定制性和灵活性。
270 2
|
3月前
|
分布式计算 Hadoop Java
Hadoop集群搭建,基于3.3.4hadoop和centos8【图文教程-从零开始搭建Hadoop集群】,常见问题解决
本文是一份详细的Hadoop集群搭建指南,基于Hadoop 3.3.4版本和CentOS 8操作系统。文章内容包括虚拟机创建、网络配置、Java与Hadoop环境搭建、克隆虚拟机、SSH免密登录设置、格式化NameNode、启动Hadoop集群以及通过UI界面查看Hadoop运行状态。同时,还提供了常见问题的解决方案。
Hadoop集群搭建,基于3.3.4hadoop和centos8【图文教程-从零开始搭建Hadoop集群】,常见问题解决
|
2月前
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤
【10月更文挑战第7天】本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。同时,文章还对比了编译源码安装与使用 RPM 包安装的优缺点,帮助读者根据自身需求选择合适的方法。
60 3
|
4月前
|
分布式计算 资源调度 Hadoop
centos7二进制安装Hadoop3
centos7二进制安装Hadoop3
|
4月前
|
分布式计算 Java Hadoop
centos7编译安装Hadoop3
centos7编译安装Hadoop3
|
4月前
|
关系型数据库 MySQL Linux
【一键解锁神秘力量!】CentOS 7 通过编译源码方式安装 MySQL 数据库 —— 从零到英雄的数据库安装实战秘籍!
【8月更文挑战第9天】随着业务增长,对数据库的需求日益提高。在 CentOS 7 中,通过编译源码安装 MySQL 可提供更高定制性和灵活性。本文详细介绍从准备环境、下载源码、配置编译参数到安装 MySQL 的全过程,并对比 RPM 包安装方法,帮助读者根据需求选择合适方案。实践时需注意备份数据、选择合适版本、确保安全性和调优性能等要点。
228 1