下载源代码:
wget http://mirror.esocc.com/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz
然后解压:
tar zxvf hadoop-2.2.0-src.tar.gz
cd hadoop-2.2.0-src
运行下面的命令开始编译:
~/code/hadoop-2.2.0-src$ mvn package -Pdist,native -DskipTests -Dtar
下载了很多maven的东东后,编译报错:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/hduser/code/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[88,11] error: cannot access AbstractLifeCycle
[ERROR] class file for org.mortbay.component.AbstractLifeCycle not found
/home/hduser/code/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[96,29] error: cannot access LifeCycle
[ERROR] class file for org.mortbay.component.LifeCycle not found
编辑hadoop-common-project/hadoop-auth/pom.xml文件,添加依赖:
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
再次编译,这个错误解决了。
之后遇到了没有安装protocol buffer库的错误,安装一下:
[INFO] --- hadoop-maven-plugins:2.2.0:protoc (compile-protoc) @ hadoop-common ---
[WARNING] [protoc, --version] failed: java.io.IOException: Cannot run program "protoc": error=2, No such file or directory
sudo apt-get install libprotobuf-dev
然后再次运行maven命令编译。发现新的错误,原来ubuntu的安装包里面没有带上protoc编译器。算了,下源代码自己编译。
hduser@hm1:/usr/src$ sudo wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
...
$ sudo ./configure
$ sudo make
$ sudo make check
$ sudo make install
$ sudo ldconfig
$ protoc --version
hduser@hm1:~$ start-dfs.sh
Starting namenodes on [localhost]
localhost: namenode running as process 983. Stop it first.
localhost: datanode running as process 1101. Stop it first.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: secondarynamenode running as process 1346. Stop it first.
再来编译。等...., 说明hadoop不准备64bit的库浪费了大家多少时间。
还有错:
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
[exec] system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
安装openssl库
sudo apt-get install libssl-dev
再来一次,编译成功了。在目录/home/hduser/code/hadoop-2.2.0-src/hadoop-dist/target 下有文件:
hadoop-2.2.0.tar.gz
解压后,进入目录,然后复制native 目录里的东西到制定位置,覆盖32bit文件
sudo cp -r ./hadoop-2.2.0/lib/native/* /usr/local/hadoop/lib/native/
现在回到~目录,运行下面的命令,成功了。
hduser@hm1:~$ start-dfs.sh
Starting namenodes on [localhost]
localhost: namenode running as process 983. Stop it first.
localhost: datanode running as process 1101. Stop it first.
Starting secondary namenodes [0.0.0.0]
0.0.0.0: secondarynamenode running as process 1346. Stop it first.
hduser@hm1:~$ start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn-hduser-resourcemanager-hm1.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-hduser-nodemanager-hm1.out
hduser@hm1:~$ jps
32417 Jps
1101 DataNode
1346 SecondaryNameNode
983 NameNode
现在运行例子程序, 注意/etc/hosts中我配置了
127.0.0.1 hm1
hduser@hm1:~/code/hadoop-2.2.0-src$ cd /usr/local/hadoop/
hduser@hm1:/usr/local/hadoop$ hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar pi 2 5
Number of Maps = 2
Samples per Map = 5
Wrote input for Map #0
Wrote input for Map #1
Starting Job
14/02/21 18:07:29 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
14/02/21 18:07:30 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 0 time(s); retry policy is RetryUpToMaximumC\
fountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
14/02/21 18:07:31 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 1 time(s); retry policy is RetryUpToMaximumC\
ountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
14/02/21 18:07:32 INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032. Already tried 2 time(s); retry policy is RetryUpToMaximumC\
ountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
需要在yarn-site.xml中添加写配置:
<property>
<name>yarn.resourcemanager.address</name>
<value>127.0.0.1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>127.0.0.1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>127.0.0.1:8031</value>
</property>
重新启动虚拟机,再次启动服务,现在连接问题解决了。
hduser@hm1:/usr/local/hadoop$ hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar pi 2 5
Number of Maps = 2
Samples per Map = 5
Wrote input for Map #0
Wrote input for Map #1
Starting Job
14/02/21 18:15:53 INFO client.RMProxy: Connecting to ResourceManager at /127.0.0.1:8032
14/02/21 18:15:54 INFO input.FileInputFormat: Total input paths to process : 2
14/02/21 18:15:54 INFO mapreduce.JobSubmitter: number of splits:2
14/02/21 18:15:54 INFO Configuration.deprecation: user.name is deprecated. Instead, use mapreduce.job.user.name
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.map.tasks.speculative.execution is deprecated. Instead, use mapreduce.map.speculative
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.output.value.class is deprecated. Instead, use mapreduce.job.output.value.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.reduce.tasks.speculative.execution is deprecated. Instead, use mapreduce.reduce.specul\
ative
14/02/21 18:15:54 INFO Configuration.deprecation: mapreduce.map.class is deprecated. Instead, use mapreduce.job.map.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.job.name is deprecated. Instead, use mapreduce.job.name
14/02/21 18:15:54 INFO Configuration.deprecation: mapreduce.reduce.class is deprecated. Instead, use mapreduce.job.reduce.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapreduce.inputformat.class is deprecated. Instead, use mapreduce.job.inputformat.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.input.dir is deprecated. Instead, use mapreduce.input.fileinputformat.inputdir
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir
14/02/21 18:15:54 INFO Configuration.deprecation: mapreduce.outputformat.class is deprecated. Instead, use mapreduce.job.outputformat.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.output.key.class is deprecated. Instead, use mapreduce.job.output.key.class
14/02/21 18:15:54 INFO Configuration.deprecation: mapred.working.dir is deprecated. Instead, use mapreduce.job.working.dir
14/02/21 18:15:54 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1393006528872_0001
14/02/21 18:15:54 INFO impl.YarnClientImpl: Submitted application application_1393006528872_0001 to ResourceManager at /127.0.0.1:8032
14/02/21 18:15:55 INFO mapreduce.Job: The url to track the job: http://localhost:8088/proxy/application_1393006528872_0001/
14/02/21 18:15:55 INFO mapreduce.Job: Running job: job_1393006528872_0001
如果重来一次的话,顺序应该是先编译64bit版本,然后用这个版本进行配置安装。
分享到:
相关推荐
以上步骤将帮助你在Ubuntu 12.04上成功编译64位的Hadoop 2.2.0。请确保每一步都按照指示操作,特别是protobuf的版本匹配和Hadoop-auth的pom.xml修改,这是编译过程中常见的问题所在。如果遇到错误,参考官方文档...
【在 Ubuntu12.04 上安装 Hadoop-1.2.1】的详细步骤 在 Ubuntu12.04 上安装 Hadoop-1.2.1 的过程涉及到多个环节,包括系统准备、用户权限设置、Java 开发环境的安装、Hadoop 的下载与配置、主机名与网络设置以及 ...
Ubuntu12.04下安装Hadoop2.4.0单机模式详细教程
本文档总结了如何在Ubuntu12.04 64bit下搭建Android编译环境
Ubuntu12.04菜鸟使用手册合集+Ubuntu标准教程Ubuntu12.04菜鸟使用手册合集+Ubuntu标准教程Ubuntu12.04菜鸟使用手册合集+Ubuntu标准教程Ubuntu12.04菜鸟使用手册合集+Ubuntu标准教程Ubuntu12.04菜鸟使用手册合集+...
【Ubuntu12.04菜鸟使用手册合集】是一份专为初学者设计的资源,旨在帮助用户熟悉Ubuntu 12.04操作系统的基本操作和功能。Ubuntu是基于Debian的开源Linux发行版,以其易用性和稳定性而受到全球用户的喜爱。这份合集...
**Ubuntu 12.04 菜鸟使用手册(全)** Ubuntu 12.04 是一个基于Debian的开源操作系统,以其用户友好性和稳定性而受到广大用户的喜爱。这个版本,也被称作Precise Pangolin(精确的穿山甲),在2012年发布,提供长达...
Ubuntu 12.04是一款长期支持(LTS)版本,这意味着它会得到长达五年的官方支持,包括安全更新和bug修复。因此,对于那些需要稳定环境的用户,如服务器管理员,Ubuntu 12.04是一个理想的选择。尽管现在这个版本已经...
《Ubuntu 12.04 使用手册1—4》是一套专为Ubuntu 12.04 LTS(长期支持版)用户编写的详尽指南,旨在帮助初学者和进阶用户掌握这一开源操作系统的基本操作与高级技巧。Ubuntu 12.04,代号“Precise Pangolin”,是...
在Ubuntu 12.04 LTS(一个基于Debian的Linux发行版)的i386架构上编译意味着这个OpenCV版本已经适应了32位系统。这很重要,因为虽然64位系统已经成为主流,但仍有大量32位系统在运行,尤其是在嵌入式设备或旧硬件上...
在Ubuntu 12.04这个稳定且广泛应用的操作系统版本上编译APUE的源码,为开发者提供了一个理想的实践平台,特别是对那些想要学习Linux C编程的初学者和进阶者。 首先,我们需要理解Ubuntu 12.04(代号Precise ...
Ubuntu 12.04(Precise Pangolin)是Ubuntu发布史上较为经典的一个版本,于2012年4月发布,拥有长期支持(LTS)特性,直到2017年4月停止官方支持。对于Linux新手来说,Ubuntu 12.04是一个良好的起点,其用户界面友好...
Ubuntu 12.04 菜鸟使用手册(三)
andrid ubuntu12.04和14.04的编译环境,目前在开发android底层和中夹层,一直都用的整个编译环境,需要的小伙伴可以看看
Ubuntu 12.04 下安装 Nginx、Python、uWSGI 和 Django 的步骤 在本文中,我们将介绍如何在 Ubuntu 12.04 环境下安装 Nginx、Python、uWSGI 和 Django。这些技术栈组合是非常流行的 Web 应用程序开发环境。 一、...
在本文档中,作者分享了如何在Ubuntu 12.04 LTS系统上搭建Qt和Qt-Embedded(Qt Embedded)的开发环境。首先,我们来详细了解这个过程。 Qt是一个流行的跨平台应用程序开发框架,用于创建具有用户友好界面的桌面和...
软件方面,需要安装jdk-7u55-linux-x64.rpm、apache-maven-3.1.1-bin.tar、hadoop-2.2.0-src.tar.gz、protobuf-2.5.0.tar.gz、zookeeper-3.4.5.tar.gz和hbase-0.96.2-hadoop2-bin.tar.gz等软件。 Hadoop2.2安装和...