Pig Installation

Before we start with the actual process, change user to 'hduser' (user used for Hadoop configuration).

1) Download stable latest release of Pig (version 0.12.1 used for this tutorial) from any one of the mirrors sites available at


Select tar.gz (and not src.tar.gz) file to download.

2) Once download is complete, navigate to the directory containing the downloaded tar file and move the tar to the location where you want to setup Pig. In this case we will move to /usr/local. 

Move to directory containing Pig Files

cd /usr/local

Extract contents of tar file as below

sudo tar -xvf pig-0.12.1.tar.gz

 Modify ~/.bashrc to add Pig related environment variables

Open ~/.bashrc file in any text editor of your choice and do below modifications-

export PIG_HOME=<Installation directory of Pig>

 Now, source this environment configuration using below command

. ~/.bashrc

We need to recompile PIG to support Hadoop 2.2.0. For the purpose follow the steps mentioned

Go to PIG home directory


Install ant

sudo apt-get install ant


Download will start and will consume time as per your internet speed.

Recompile PIG

sudo ant clean jar-all -Dhadoopversion=23


In this recompilation process multiple components are downloaded. So, system should be connected to internet.

Also, if the process stuck somewhere and you dont see any movement on command prompt for more than 20 minutes then press ctrl + c and rerun the same command.

 Test the Pig installation using command

pig -help


Was this answer helpful? 0 Users Found This Useful (0 Votes)