0% found this document useful (0 votes)
132 views2 pages

Pig Installation On Mac and Linux

This document provides instructions for installing Pig on Linux and Mac in local mode. It involves: 1. Downloading and installing the latest stable version of Java by extracting the JDK tar file and configuring environment variables. 2. Downloading and extracting the Pig tar file. 3. Running Pig in local mode by navigating to the bin directory and running commands. 4. Provides a solution for errors related to Java not being installed by configuring the JAVA_HOME variable in the pig.bin file.

Uploaded by

Ram Guggul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views2 pages

Pig Installation On Mac and Linux

This document provides instructions for installing Pig on Linux and Mac in local mode. It involves: 1. Downloading and installing the latest stable version of Java by extracting the JDK tar file and configuring environment variables. 2. Downloading and extracting the Pig tar file. 3. Running Pig in local mode by navigating to the bin directory and running commands. 4. Provides a solution for errors related to Java not being installed by configuring the JAVA_HOME variable in the pig.bin file.

Uploaded by

Ram Guggul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Installing PIG on Linux and Mac (Local Mode)

1. Installing Java
a. Select the latest stable version of Java from this ​link​.

b. Click on the download button under ‘JDK’ and accept the licence.

c. Select your OS and the download will start.

d. Open the terminal and go to the directory where the JDK is downloaded.

e. You will see a .tar file in that location, which is the file you just downloaded.

f. Unzip it using ​tar -xvzf <name of the file>​.

g. Use the ‘​ls​’ command to see the contents of the jdk directory that was created
after unzipping the .tar file.

h. Go to the ​/usr/lib​ directory by running the ​cd /usr/lib​ command.

i. Check if a folder named ​java ​already exists there​. ​If not, create one using the
command ​sudo mkdir java​. Enter the password and the folder will be created.

j. Move into the java folder using the command ​cd java​. And check if there is
already a folder with the same name you got after unzipping the .tar file in step
f.

k. If such a folder exists, then you already have Java installed.

l. If not, return to the directory you were in when performing step g.

m. Run the command ​sudo mv <name of the folder> /usr/lib/java​.

n. Now to update the .bachrc file, use the command ​cd ~

o. Use any text editor to open the .bashrc file. For example, ​sudo vi ~/.bashrc

p. At the end of the file, add the following:


export JAVA_HOME = /usr/lib/java/<name of the folder in step g>

export PATH = “$PATH:$JAVA_HOME/bin”

q. Close the terminal and open a new one. Use the command ​java -version​ to check
if Java is installed properly or not.

r. If installed properly, it will show the Java version; else, it will show that the
command does not exist.

2. Installing PIG
a. Open the terminal and download the PIG .tar file using the command
wget http://www.apache.org/dist/pig/pig-0.17.0/pig-0.17.0.tar.gz

b. Use the ​ls​ command to see if a .tar file has been downloaded.

c. Unzip the .tar file using the command ​tar -xvzf <name of the tar file
downloaded>​.

d. Note the path of the unzipped file.


e. Now to run pig you need to go inside your pig-0.17.0/bin directory.
f. you can move inside the PIG directory using the command ​cd <path in step
2.d>/pig-0.17.0/bin.

g. Type the command ./​pig -version​ and you will see the version of PIG.

h. Type the command ./​pig -x local​ to start the grunt shell in local mode.

Common errors and their solutions

1. If you encounter the error ‘​JAVA is not installed​’​ ​or other Java-related errors, follow
these steps:
a. Open the pig.bin file in any text editor.
b. At the top of the code, set the JAVA_HOME variable as:
JAVA_HOME = <path used for JAVA_HOME in step 1.p.i>

You might also like