设为首页 收藏本站
查看: 1010|回复: 0

[经验分享] 64位操作系统下重新编译hadoop-2.2.0

[复制链接]

尚未签到

发表于 2016-12-12 09:00:23 | 显示全部楼层 |阅读模式
操作系统oracle linux 5.8 64bit

1.yum光盘源设置
vi /etc/yum.repos.d/rhel-debuginfo.repo
[base]
name=Server Local Sources
baseurl=file:///media/Server
enabled=1
gpcheck=1
gpgkey=file:///media/RPM-GPG-KEY-oracle


2.因为是最小化安装的系统,需要安装如下软件包
[iyunv@hadoop1 ~]# yum install lzo-devel  zlib-devel  gcc autoconf automake libtool   ncurses-devel openssl-deve

3.安装maven
根据网上查得,最新的maven3.1.1与hadoop2.2.0有兼容性问题,这里用maven3.0.5

[iyunv@hadoop1 ~]# wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz

因为下载的是已经编译好的,所以直接解压就可以了

[iyunv@hadoop1 ~]# tar zxvf apache-maven-3.0.5-bin.tar.gz -C /usr/local/
[iyunv@hadoop1 ~]# mv /usr/local/apache-maven-3.0.5/ /usr/local/maven

设置环境变量
[iyunv@hadoop1 local]# vi /etc/profile

添加以下内容
export MAVEN_HOME=/usr/local/maven

4.安装ant
[iyunv@hadoop1 ~]# wget http://mirror.esocc.com/apache//ant/binaries/apache-ant-1.9.3-bin.tar.gz
[iyunv@hadoop1 ~]# tar zxvf  apache-ant-1.9.3-bin.tar.gz -C /usr/local/
[iyunv@hadoop1 ~]# mv /usr/local/apache-ant-1.9.3/ /usr/local/ant
[iyunv@hadoop1 ~]# vi /etc/profile
export ANT_HOME=/usr/local/ant

5.安装findbugs
[iyunv@hadoop1 ~]# wget http://prdownloads.sourceforge.net/findbugs/findbugs-2.0.3.tar.gz?download
[iyunv@hadoop1 ~]# tar zxvf findbugs-2.0.3.tar.gz -C /usr/local/
[iyunv@hadoop1 ~]# mv /usr/local/findbugs-2.0.3/ /usr/local/findbugs
[iyunv@hadoop1 ~]# vi /etc/profile
export FINDBUGS_HOME=/usr/local/findbugs

6.安装protobuf
[iyunv@hadoop1 ~]# wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
[iyunv@hadoop1 ~]# tar zxvf protobuf-2.5.0.tar.gz
[iyunv@hadoop1 ~]# cd protobuf-2.5.0
[iyunv@hadoop1 protobuf-2.5.0]# ./configure

这里报了一个错:
configure: error: in `/root/protobuf-2.5.0':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check

是c++的编译器没有安装

[iyunv@hadoop1 protobuf-2.5.0]# yum install gcc-c++

然后重新编译protobuf并安装
[iyunv@hadoop1 protobuf-2.5.0]# ./configure
[iyunv@hadoop1 protobuf-2.5.0]# make
[iyunv@hadoop1 protobuf-2.5.0]# make install

7.把上面的几个软件加到PATH变量里
[iyunv@hadoop1 ~]# vi /etc/profile
export PATH=$PATH:$MAVEN_HOME/bin:$ANT_HOME/bin:$FINDBUGS_HOME/bin
运行profile使得这些配置生效
[iyunv@hadoop1 ~]# source /etc/profile

8.编译hadoop
[iyunv@hadoop1 ~]# wget http://mirror.esocc.com/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz
[iyunv@hadoop1 ~]# tar zxvf hadoop-2.2.0-src.tar.gz

这里网上查得hadoop2.2.0的源码包里面还有一个bug:
https://issues.apache.org/jira/browse/HADOOP-10110

根据HADOOP-10110.patch,做如下修改:
[iyunv@hadoop1 hadoop-2.2.0-src]# vi hadoop-common-project/hadoop-auth/pom.xml
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty-util</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <scope>test</scope>
     </dependency>

然后就开始编译hadoop了
[iyunv@hadoop1 hadoop-2.2.0-src]# mvn package -DskipTests -Pdist,native -Dtar

没想到编译过程也是需要配JAVA_HOME的
[iyunv@hadoop1 hadoop-2.2.0-src]# export JAVA_HOME=/home/hadoop/jdk
[iyunv@hadoop1 hadoop-2.2.0-src]# export PATH=$PATH:$JAVA_HOME/bin

再重新来
[iyunv@hadoop1 hadoop-2.2.0-src]# mvn package -DskipTests -Pdist,native -Dtar

之后就是漫长的等待了。这里还有一个要注意的是这个过程里面它会自己到网上下载很多东西的,可别把网断了。

最终还是报了一个错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-common: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "cmake" (in directory "/root/hadoop-2.2.0-src/hadoop-common-project/hadoop-common/target/native"): error=2, No such file or directory -> [Help 1]

似乎是没有安装cmake
[iyunv@hadoop1 ~]# cd
[iyunv@hadoop1 ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz
[iyunv@hadoop1 ~]# tar zxvf cmake-2.8.12.2.tar.gz
[iyunv@hadoop1 ~]# cd cmake-2.8.12.2
[iyunv@hadoop1 ~]# ./configure
[iyunv@hadoop1 ~]# gmake
[iyunv@hadoop1 ~]# gmake install

安装好cmake后再来一次
[iyunv@hadoop1 ~]# cd
[iyunv@hadoop1 ~]# cd hadoop-2.2.0-src
[iyunv@hadoop1 hadoop-2.2.0-src]# mvn package -DskipTests -Pdist,native -Dtar

这次报了这么一个错
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (make) on project hadoop-hdfs: An Ant BuildException has occured: exec returned: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command[ERROR]   mvn <goals> -rf :hadoop-hdfs

没看出什么个意思,再往上看,注意到了这一段
     
[exec] CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
[exec]   Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)     
[exec] Call Stack (most recent call first):     
[exec]   /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:102 (find_package_handle_standard_args)     
[exec]   main/native/fuse-dfs/CMakeLists.txt:23 (find_package)

安装pkgconfig
[iyunv@hadoop1 hadoop-2.2.0-src]# yum install pkgconfig

继续,这次把安装提示重新定向到一个文件里,方便查看错误:
[iyunv@hadoop1 hadoop-2.2.0-src]# mvn package -DskipTests -Pdist,native -Dtar > install2.log

错误:
[exec] CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):   
[exec]   Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the     
[exec]   system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES     
[exec]   OPENSSL_INCLUDE_DIR)     
[exec] Call Stack (most recent call first):     
[exec]   /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)     
[exec]   /usr/local/share/cmake-2.8/Modules/FindOpenSSL.cmake:313 (find_package_handle_standard_args)     
[exec]   CMakeLists.txt:20 (find_package)     
[exec]      
[exec]      
[exec] -- Configuring incomplete, errors occurred!
[exec]   /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)

[iyunv@hadoop1 ~]# yum install openssl
Loaded plugins: rhnplugin, securityThis system is not registered with ULN.ULN support will be disabled.
Setting up Install ProcessPackage openssl-0.9.8e-22.el5.x86_64 already installed and latest versionPackage openssl-0.9.8e-22.el5.i686 already installed and latest versionNothing to do

openssl已经安装了,那就把openssl-devel安装一下
[iyunv@hadoop1 ~]# yum install openssl-devel

继续:
[iyunv@hadoop1 hadoop-2.2.0-src]# mvn package -DskipTests -Pdist,native -Dtar > install3.log

这次终于完成了,验证一下:
[iyunv@hadoop1 hadoop-2.2.0-src]# cd hadoop-dist/target/hadoop-2.2.0/lib/native/
[iyunv@hadoop1 native]# file libhadoop.so.1.0.0
libhadoop.so.1.0.0: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not strippedhadoop-dist/target

目录下hadoop-2.2.0.tar.gz也有了,以后应该就可以直接用了。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-313018-1-1.html 上篇帖子: ma-hadoop集群-配置文件-进程地址端口-和hive hbase关系 下篇帖子: hadoop环境配置(虚拟机安装、JDK、SSH免密登录)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表