Pig Installation in Ubuntu

Step1. Download and extract the tar file.

·   Download Pig-0.11.1.tar.gz from here 


·   Enter into the directory where the tar file is downloaded. By default it get downloaded in “Downloads” directory of your system. Use the following command to enter into the directory:

         $ cd Downloads

    Unzip the tar file by using the command,

     $ sudo tar  xvf  
          ‘home/easylearning/Downloads/pig-0.11.1.tar.gz’


Unzipped pig-0.11.1 directory


Rename the pig-0.11.1.tar.gz directory to pig directory.


Step 2. Move pig directory to another destination.

       $ sudo mv <src> <destination  dir>

eg.  sudo mv '/home/easylearning/Downloads/pig'   /usr/local


Step3. Set PIG_HOME path to the .bashrc file

     To open bashrc file, use this command:

      $ sudo gedit $HOME/.bashrc


  In bashrc file, add the following lines of code.

      export PIG_HOME=/usr/local/pig
      export PATH=$PATH:$PIG_HOME/bin


Step 4. Set the environment variable of java and pig in '/etc/profile' file.

Open the profile file by using the following command.

 $ sudo gedit /etc/profile


Add the following lines at the end of that file

export PIG_INSTALL=/home/easylearning/pig-0.11.1
export PATH=$PATH:$PIG_INSTALL/bin
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export PIG_CLASSPATH=/usr/local/hadoop/conf/




Step 5: ‘Source’ is a bash shell built-in command that executes the content of the file passed as argument in the current shell. It reads and executes commands from ‘filename’ in the current shell environment.

$ sudo /etc/profile



Step 6. Disabling the DFS permission, by adding property code to /hadoop/conf/hdfs-site.xml (optional)

 <property>
 <name>dfs.permissions</name>
 <value>false</value>
 </property>



Step 7. Restart the system and then start the Hadoop first by using the commands:

Go to the Hadoop directory

$ cd /usr/local/hadoop
usr/local/hadoop$ bin/start-all.sh


Step 8. Start Pig in MapReduce mode, by using the following commands:

$ pig -x mapreduce
  or
$ pig


Popular Posts