Skip to main content

Building Hadoop on Windows

This post will describe how to build Apache Hadoop (https://hadoop.apache.org/) on a Windows machine. Sometimes you're required to develop or test on Windows machines and in those cases you will need to build Hadoop from scratch because the available pre-built binaries for this OS family don't work fine.
The process described in this post has been tested on Windows Vista and Windows Server 2008 64-bit.
I started from the current stable version (2.7.1) of the Hadoop source code.

Steps:
 - Download a JDK 7 (IBM and Oracle work both).
 - Set the JAVA_HOME variable.
 - Download the Windows SDK 7.1 from one of the following links:
    http://www.microsoft.com/en-in/download/details.aspx?id=8442    (DVD ISO)
    or
    http://www.microsoft.com/en-us/download/confirmation.aspx?id=8279    (Web installer)
    and install it. This SDK comes with the .NET framework 4: it is mandatory to use this release in order to successfully complete the Hadoop building process.
 - Locate the MSBuild.exe (What is MSBuild.exe) and add its location to your system PATH.
 - Download and install CygWin (https://cygwin.com/setup-x86_64.exe)
   During the installation process make sure to select the openssh package and its associated prerequisites from the Select packages tab.
 - Install Maven 3.x (I have used the release 3.1.1, but any 3.x should work fine).
 - Set the M2_HOME variable.
 - Set the Platform variable to x64.
 - Install the Protocol Buffer (Official website), release 2.5.0. At present time the latest stable version is the 2.6.1, but Hadoop 2.7.1 requires the 2.5.0, downloadable from https://github.com/google/protobuf/releases/tag/v2.5.0    It doesn't build using later versions.
 - Set up the PATH variable including the Maven bin folder, the Cygwin bin and usr\sbin folders and the Protocol Buffer root folder.
 - Install CMake (http://www.cmake.org/download/) and include its bin folder to the PATH variable.
 - Download the Hadoop core source code archive from http://www.apache.org/dist/hadoop/core/hadoop-2.7.1/
    and extract its content in any folder you like.
- Build the source code:
    - Select Start —> All Programs —> Microsoft Windows SDK v7.1 and open the Windows SDK 7 command prompt as administrator. Change the working directory to the one where you have extracted the Hadoop source code. Then run the following Maven command:
        mvn package -Pdist,native-win -DskipTests -Dtar
In order to successfully build Hadoop you have to follow all of the steps above and use the exact same releases for the required tools.
This is the summary you will receive when everything has been built successfully:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Hadoop Main ................................. SUCCESS [  3.978 s]
[INFO] Apache Hadoop Project POM .......................... SUCCESS [  1.919 s]
[INFO] Apache Hadoop Annotations .......................... SUCCESS [  4.368 s]
[INFO] Apache Hadoop Assemblies ........................... SUCCESS [  0.265 s]
[INFO] Apache Hadoop Project Dist POM ..................... SUCCESS [  2.918 s]
[INFO] Apache Hadoop Maven Plugins ........................ SUCCESS [  4.290 s]
[INFO] Apache Hadoop MiniKDC .............................. SUCCESS [  3.728 s]
[INFO] Apache Hadoop Auth ................................. SUCCESS [  8.409 s]
[INFO] Apache Hadoop Auth Examples ........................ SUCCESS [  4.851 s]
[INFO] Apache Hadoop Common ............................... SUCCESS [03:09 min]
[INFO] Apache Hadoop NFS .................................. SUCCESS [ 10.795 s]
[INFO] Apache Hadoop KMS .................................. SUCCESS [ 23.120 s]
[INFO] Apache Hadoop Common Project ....................... SUCCESS [  0.078 s]
[INFO] Apache Hadoop HDFS ................................. SUCCESS [03:51 min]
[INFO] Apache Hadoop HttpFS ............................... SUCCESS [ 27.940 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal .............. SUCCESS [  8.440 s]
[INFO] Apache Hadoop HDFS-NFS ............................. SUCCESS [  5.928 s]
[INFO] Apache Hadoop HDFS Project ......................... SUCCESS [  0.062 s]
[INFO] hadoop-yarn ........................................ SUCCESS [  0.063 s]
[INFO] hadoop-yarn-api .................................... SUCCESS [02:27 min]
[INFO] hadoop-yarn-common ................................. SUCCESS [ 49.234 s]
[INFO] hadoop-yarn-server ................................. SUCCESS [  0.063 s]
[INFO] hadoop-yarn-server-common .......................... SUCCESS [ 18.237 s]
[INFO] hadoop-yarn-server-nodemanager ..................... SUCCESS [ 22.698 s]
[INFO] hadoop-yarn-server-web-proxy ....................... SUCCESS [  4.851 s]
[INFO] hadoop-yarn-server-applicationhistoryservice ....... SUCCESS [ 12.434 s]
[INFO] hadoop-yarn-server-resourcemanager ................. SUCCESS [ 30.717 s]
[INFO] hadoop-yarn-server-tests ........................... SUCCESS [  7.862 s]
[INFO] hadoop-yarn-client ................................. SUCCESS [ 10.827 s]
[INFO] hadoop-yarn-server-sharedcachemanager .............. SUCCESS [  4.477 s]
[INFO] hadoop-yarn-applications ........................... SUCCESS [  0.063 s]
[INFO] hadoop-yarn-applications-distributedshell .......... SUCCESS [  3.572 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher ..... SUCCESS [  2.730 s]
[INFO] hadoop-yarn-site ................................... SUCCESS [  0.063 s]
[INFO] hadoop-yarn-registry ............................... SUCCESS [  8.502 s]
[INFO] hadoop-yarn-project ................................ SUCCESS [  8.003 s]
[INFO] hadoop-mapreduce-client ............................ SUCCESS [  0.125 s]
[INFO] hadoop-mapreduce-client-core ....................... SUCCESS [ 37.035 s]
[INFO] hadoop-mapreduce-client-common ..................... SUCCESS [ 30.374 s]
[INFO] hadoop-mapreduce-client-shuffle .................... SUCCESS [  7.785 s]
[INFO] hadoop-mapreduce-client-app ........................ SUCCESS [ 16.395 s]
[INFO] hadoop-mapreduce-client-hs ......................... SUCCESS [ 10.640 s]
[INFO] hadoop-mapreduce-client-jobclient .................. SUCCESS [ 17.223 s]
[INFO] hadoop-mapreduce-client-hs-plugins ................. SUCCESS [  4.024 s]
[INFO] Apache Hadoop MapReduce Examples ................... SUCCESS [ 10.921 s]
[INFO] hadoop-mapreduce ................................... SUCCESS [  5.023 s]
[INFO] Apache Hadoop MapReduce Streaming .................. SUCCESS [  9.750 s]
[INFO] Apache Hadoop Distributed Copy ..................... SUCCESS [ 18.753 s]
[INFO] Apache Hadoop Archives ............................. SUCCESS [  4.010 s]
[INFO] Apache Hadoop Rumen ................................ SUCCESS [ 10.000 s]
[INFO] Apache Hadoop Gridmix .............................. SUCCESS [  8.300 s]
[INFO] Apache Hadoop Data Join ............................ SUCCESS [  4.291 s]
[INFO] Apache Hadoop Ant Tasks ............................ SUCCESS [  3.604 s]
[INFO] Apache Hadoop Extras ............................... SUCCESS [  5.445 s]
[INFO] Apache Hadoop Pipes ................................ SUCCESS [  0.062 s]
[INFO] Apache Hadoop OpenStack support .................... SUCCESS [  7.425 s]
[INFO] Apache Hadoop Amazon Web Services support .......... SUCCESS [ 25.584 s]
[INFO] Apache Hadoop Azure support ........................ SUCCESS [ 11.138 s]
[INFO] Apache Hadoop Client ............................... SUCCESS [ 13.385 s]
[INFO] Apache Hadoop Mini-Cluster ......................... SUCCESS [  0.140 s]
[INFO] Apache Hadoop Scheduler Load Simulator ............. SUCCESS [  8.268 s]
[INFO] Apache Hadoop Tools Dist ........................... SUCCESS [ 12.948 s]
[INFO] Apache Hadoop Tools ................................ SUCCESS [  0.047 s]
[INFO] Apache Hadoop Distribution ......................... SUCCESS [ 49.281 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------


Do you think it is easy? Let's have a look at the following post with a list of the most common error messages you could receive (and their causes and solutions as well). Stay tuned!

Comments

Popular posts from this blog

Exporting InfluxDB data to a CVS file

Sometimes you would need to export a sample of the data from an InfluxDB table to a CSV file (for example to allow a data scientist to do some offline analysis using a tool like Jupyter, Zeppelin or Spark Notebook). It is possible to perform this operation through the influx command line client. This is the general syntax: sudo /usr/bin/influx -database '<database_name>' -host '<hostname>' -username '<username>'  -password '<password>' -execute 'select_statement' -format '<format>' > <file_path>/<file_name>.csv where the format could be csv , json or column . Example: sudo /usr/bin/influx -database 'telegraf' -host 'localhost' -username 'admin'  -password '123456789' -execute 'select * from mem' -format 'csv' > /home/googlielmo/influxdb-export/mem-export.csv

jOOQ: code generation in Eclipse

jOOQ allows code generation from a database schema through ANT tasks, Maven and shell command tools. But if you're working with Eclipse it's easier to create a new Run Configuration to perform this operation. First of all you have to write the usual XML configuration file for the code generation starting from the database: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd">   <jdbc>     <driver>oracle.jdbc.driver.OracleDriver</driver>     <url>jdbc:oracle:thin:@dbhost:1700:DBSID</url>     <user>DB_FTRS</user>     <password>password</password>   </jdbc>   <generator>     <name>org.jooq.util.DefaultGenerator</name>     <database>       <name>org.jooq.util.oracle.OracleDatabase</name>     ...

Turning Python Scripts into Working Web Apps Quickly with Streamlit

 I just realized that I am using Streamlit since almost one year now, posted about in Twitter or LinkedIn several times, but never wrote a blog post about it before. Communication in Data Science and Machine Learning is the key. Being able to showcase work in progress and share results with the business makes the difference. Verbal and non-verbal communication skills are important. Having some tool that could support you in this kind of conversation with a mixed audience that couldn't have a technical background or would like to hear in terms of results and business value would be of great help. I found that Streamlit fits well this scenario. Streamlit is an Open Source (Apache License 2.0) Python framework that turns data or ML scripts into shareable web apps in minutes (no kidding). Python only: no front‑end experience required. To start with Streamlit, just install it through pip (it is available in Anaconda too): pip install streamlit and you are ready to execute the working de...