Build Hadoop 2.7.x from source code on ubuntu

Following are the steps for building Hadoop 2.7.x from source code on ubuntu.

Checout Hadoop Code from Git

git clone git://git.apache.org/hadoop.git
git checkout branch-2.7.3

 

Install Dependencies

Install dependencies from apt-get

sudo apt-get update
sudo apt-get install openjdk-7-jdk maven git openssl dh-autoreconf cmake zlib1g-dev libssl-dev ssh rsync pkg-config

Install protocol buffer

wget https://github.com/google/protobuf/archive/v2.5.0.tar.gz
tar xvf v2.5.0.tar.gz
cd protobuf-2.5.0
./autogen.sh
./configure --prefix=/usr
make
make install

Install findbugs

wget https://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.zip/download
unzip download

 

Set Environment Variables

vim ~/.bashrc

## Put following lines at end of ~/.bashrc file
## Please change the path with appropriate value for your installation

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
export FINDBUGS_HOME=/opt/findbugs-3.0.0/

 

Build Hadoop Distribution

mvn clean install -Pdist,native,docs,src -Dtar -DskipTests

Hadoop tar.gz distribution will be created in hadoop-dist/target/ directory