Pig Installation on Ubuntu

pigExecution Modes

Pig has two execution modes :

  • Local Mode – To run Pig in local mode, you need access to a single machine; all files are installed and run using your local host and file system. Specify local mode using the -x flag (pig -x local).
  • MapReduce Mode – To run Pig in MapReduce mode, you need access to a Hadoop cluster and HDFS installation. MapReduce mode is the default mode; you can, but don’t need to, specify it using the -x flag (pig OR pig -x mapreduce).

The pig-0.11.1 installation is done in below versions of Linux and Hadoop respectively.

UBUNTU 13.4

HADOOP 1.1.2

I have hduser as a dedicated hadoop system user. I had installed my Hadoop in /home/hduser/hadoop folder. Now I am going to install pig in /usr/lib/pig folder.

  • Download Pig from here.
  • Enter into the directory where the stable version is downloaded. By default it downloads in “Downloads” directory.
$ cd Downloads/
  • Unzip the tar file.
$ tar -xvf pig-0.11.1.tar.gz
  • Create directory
$ sudo mkdir /usr/lib/pig
  • move pig-0.11.1 to pig
$ mv pig-0.11.1 /usr/lib/pig/
  • Set the PIG_HOME path in bashrc file

To open bashrc file use this command

$ gedit ~/.bashrc

 In bashrc file append the below 2 statements

export PIG_HOME=/usr/lib/pig/pig-0.11.1
export PATH=$PATH:$PIG_HOME/bin
  • Restart your computer or use [ . .bashrc]

Now let’s test the installation

On the command prompt type

$ pig -h

It shows the help related to Pig, and its various commands.

  • Starting pig in local mode
 $ pig -x local grunt>
  •  Starting pig in mapreduce mode
 $ pig -x mapreduce

                        or

 $ pig

Reference:

http://pig.apache.org/docs/r0.10.0/start.html

Note:The information provided here is best of my knowledge and experience if at all any modifications are to be made please help me with your valuable suggestion which are always welcome…. :)

Advertisements

16 Responses to Pig Installation on Ubuntu

  1. D says:

    Great tutorial 🙂

    Like

  2. Sreesha Amjuri says:

    Very helpful…… it saved a lot of my time thank you very much

    Like

  3. Pingback: Let Pig Grunt | JP on BigData

  4. Nilesh says:

    I have installed everything,likewise hadoop 1.0.4 and java 7 but i am getting problem with pig.i have installed succesfully but when m trying to run in terminal local mode ” pig -x local”,i am getting some error which is pig: invalid option — ‘x’ usage: pig . what is a solution for that can someone help me out.

    Like

  5. Satish says:

    ThankYou very much. Very helpful.

    Like

  6. Ghouse Modhin says:

    Thanks a lot

    Like

  7. Thanks for sharing your info. I truly appreciate your efforts and I will be waiting for your next post thanks once again.

    Like

  8. Good one.It helped a lot

    Like

  9. Mandar Warang says:

    Really helpful. Thank you for sharing.

    Like

  10. shireeshk says:

    Reblogged this on Sireesh Hadoop Blog and commented:
    Helpful blog for installing PIG

    Liked by 1 person

  11. Instead of “Restart your computer”, we can just say “source ~/.bashrc”

    Like

  12. There is a typo in “pig -x local grunt>”. The shell prompt in the command is misleading. It should be changed to just “pig -x local” and on next line “grunt>”

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: