hadoop入门-在windows上编译x64位hadoop

环境

Windows 7 x64位,visual studio 2010 professional

hadoop 源码版本2.2.0

步骤(来源于书《Pro Apache Hadoop, Second Edition》略作修改。

  1. Ensure that JDK 1.6 is or higher is installed. We assume that it is installed in the
    c:/MyApps/jdkl6/ folder, which should have a bin subfolder.
  2. Download
    the hadoop-2.2.x-src.tar.gz files (2.2.0 at the time of this writing) from the download section of the Apache web site for Hadoop. The download link is as follows:
    http://www.apache.org/dist/hadoop/core/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz.
  3. Explode
    the tar file into a directory. For the purpose of this section, we assume that the directory is called
    c:/myapps/hadoop/.
  4. If
    using Visual Studio, use Visual Studio 2010 Professional (not 2012). Do not use Visual Studio Express because it does not support compiling for 64-bit, which presents problems if running on a 64-bit system. Alternatively, download the Microsoft Windows SDK
    v7.1. At the time of writing, the link is the following:

    http://www.microsoft.com/en-us/download/confirmation.aspx?id=8279.

  5. Place
    the SDK in the folder with full privileges. For this section, we assume that the folder is
    c:/myapps/winsdk71/.
  6. Download
    and install the Linux-like environment for Windows named Cygwin. We assume that Cygwin home folder is
    c:/myapps/cygwin/. Ensure that the following UNIX command-line tools are installed:
    sh, mkdir, rm, cp, tar, and gzip. The download location for Cygwin is
    http://cygwin.com/install.html.
  7. Download
    and install Maven 3.1.1 or a compatible version. Installation consists of simply exploding the
    tar bundle into a Windows folder. We assume that the home folder for Maven download is
    c:/MyApps/apache-maven-3.1.1/. Verify that this folder has the bin subfolder.
  8. Download
    and install Protocol Buffers 2.5.0. At the time of writing, the link is http://protobuf.googlecode.com/files/protoc-2.5.0-win32.zip.
  9. Simply
    unzip the zip file into a folder (assumed to be c:/MyApps/protobuf/). Verify that the installation is correct by ensuring that the folder contains the
    protoc.exe file.
  10. Install
    ZLIB from http://zlib.net/zlib128-dll.zip and explode the zip file in the c:/zlib-1.2.8 folder. At runtime, this folder must be accessible from the
    PATH variable.
  11. Add
    the environment variables shown in Table A-1.

Table
A-1: Environment Variables for Windows

Environment
Variable


Value


JAVA_HOME


c:/MyApps/jdk16/


M2_HOME


c:/MyApps/apache-maven-3.1.1/


Platform


x64
(or Win32 when building on the 32-bit system)


CYGWIN_HOME


c:/myapps/cygwin/


PROTOBUF_HOME


c:/myapps/protobuf/


ZLIB_HOME


c:/zlib-1.2.8

12 .Add the following to the Windows PATH variable:

  • %JAVA_HOME%/bin/
  • %CYGWIN_HOME%/bin/
  • %M2_HOME%/bin/
  • %PROTOBUF_HOME%
  • %ZLIB_HOME

开始编译,执行下面的步骤:

hadoop 2.2.0在编译的时候有一个bug,参考https://issues.apache.org/jira/browse/HADOOP-10110描述,然后下载https://issues.apache.org/jira/secure/attachment/12614482/HADOOP-10110.patch这个patch,按照这个patch修改hadoop-common-project/hadoop-auth/pom.xml文件,然后再进行编译,否则会出错。

  1. Go to the Windows Start  All Programs  Microsoft Windows SDK v7.1 and start the Windows
    SDK 7.1 command prompt in Run As Administrator mode.
    
  2. Change the folder to c:/MyApps/hadoop. Recall that this is the folder in which the Hadoop source was placed.
  3. Execute
    the following command mvn package with the -Pdist,native-win -DskipTests -Dtar options. The exact command is this:

    
    mvn package -Pdist,native-win -DskipTests –Dtar
    
  4. If
    there are no errors, the hadoop-2.2.0.tar.gz file is created in the
    c:/myapps/hadoop/ hadoop-dist/hadoop-2.2.0/
    folder.

编译完后,如果没有任何错误,在hadoop-2.2.0-src\hadoop-dist\target目录下面会生成hadoop-2.2.0.tar.gz文件。

第一步大功告成!



时间: 2024-08-07 21:18:36

hadoop入门-在windows上编译x64位hadoop的相关文章

hadoop入门-在windows上安装,测试hadoop

上一篇简单叙述了怎么样在windows上编译hadoop,接着上一篇,这篇叙述怎么样安装hadoop并进行简单的验证安装是否正确.编译的机器与安装的机器分开. 我编译的机器是windows7,安装的机器是windows 2008 r2. 第一步:编译完之后,会在target目录下生成hadoop-2.2.0.tar.gz文件,将该文件解压到一个目录下面,然后将整个目录拷贝到目标机器上,尽量选择简单的目录,比如e:\hd 第二步:添加HADOOP_HOME到系统环境变量里,值为e:\hd.并将%H

windows上编译 python C源码

跟随<python源码剖析>一书,了解python内部机制.今天搞定了在windows上编译python源代码. 按照书中的内容,使用VS2008编译Python2.7.9.相似的步骤见下面的链接: http://www.cnblogs.com/heshizhu/archive/2012/08/09/2630346.html 我使用的是VS2008ProEdition90天的试用版,中间遇到一些问题记录一下: 无法打开文件python27.lib 原因及解决方案:系统是win8 64位,没有安

在Windows上使用Eclipse配置Hadoop MapReduce开发环境

在Windows上使用Eclipse配置Hadoop MapReduce开发环境 1. 系统环境及所需文件 windows 8.1 64bit Eclipse (Version: Luna Release 4.4.0) hadoop-eclipse-plugin-2.7.0.jar hadoop.dll & winutils.exe 2. 修改Master节点的hdfs-site.xml 添加如下内容 <property> <name>dfs.permissions<

在64位linux上编译32位程序

ld指令有一个选项:--oformat output_format,用于指定输出文件的格式.输入文件./kernel/kernel.o等是elf32格式,当前系统是64位,而ld默认生成的文件格式是elf64-x86-64:因此会出现"ld: warning: i386 architecture of input file `./kernel/kernel.o' is incompatible with i386:x86-64 output"这样的提示.之前,将系统从三墩转移到我自己的

Windows上编译PHP的MagickWand扩展

首先这是一个漫长的过程,尝试编译此插件的用户一定要有耐心.大致流程可以划分为: 编译ImageMagick 编译MagickWand 关于PHP的版本.Windows的PHP是用哪个版本的VC编译的,这个一定要先弄清楚,例如我的是VC9编译的,那么一定要下载对应的VC来编译.例如VC9对应VS2008,VC10对应VS2010. 下面切入正题: 首先下载PHP的源代码,注意你下载的源代码也要跟你Windows上的PHP可执行文件是同一个版本.例如我的是5.4.31RC1. 下载ImageMagi

[ZZ] 在windows上编译Mesa3d opengl32库

在windows上编译Mesa3d opengl32库 cheungmine http://blog.csdn.net/ubuntu64fan/article/details/8061475 Mesa3d是一套跨平台的opengl/es库, 它不提供编译好的二进制包,所以必须自己动手编译. Linux默认都带了这个软件, 因此Linux上直接用就可以了. 如果想在linux上的编译, 也比较简单, 本文不赘述.那么如何在Windows上编译这个库呢? Mesa3d官网给出了编译方法. http:

在Mac/Linux/Windows上编译corefx遇到的问题及解决方法

这两天尝试在Mac/Linux/Windows三大平台上编译.NET跨平台三驾马车(coreclr/corefx/dnx)之一的corefx(.NET Core Framework),结果三个平台的编译都失败了.后来一一都解决了,在这篇博文中分享一下. (一) 在Mac上编译corefx遇到的错误如下: /git/dotnet/corefx/dir.props(214,5): warning : The Roslyn targets do not exist- Roslyn will not b

Hadoop入门进阶步步高(四)-测试Hadoop

四.测试Hadoop 一个简单的求每年温度最大值的程序. 1.准备两个文本测试数据 准备两个名为data1.txt及data2.txt的文件,用于做为计算的输入数据,将其放于/home/fenglibin/java/data目录下: data1.txt data2.txt 1999 10 1999 20 1999 25 2000 21 2000 22 2000 18 2000 40 2001 45 2001 65 2002 90 2002 89 2002 70 2003 40 2003 80 1

Hadoop入门进阶步步高(三)-配置Hadoop

三.配置Hadoop 1.设置$HADOOP_HOME/conf/hadoop-env.sh 这个文件中设置的是Hadoop运行时需要的环境变量,在1.2.1版中共有19个环境变量,如下: 变量名称 默认值 说明 JAVA_HOME 设置JDK的路径,这个必须设置,否则Hadoop无法启动,值如: /usr/local/jdk1.6.0_33 HADOOP_CLASSPATH 空 这个用以设置用户的类路径,也可以在执行计算之前设置 HADOOP_HEAPSIZE 1000m 设置Hadoop堆的