Pig Installation On Mac and Linux
Pig Installation On Mac and Linux
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.
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.
g. Use the ‘ls’ command to see the contents of the jdk directory that was created
after unzipping the .tar file.
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.
o. Use any text editor to open the .bashrc file. For example, sudo vi ~/.bashrc
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>.
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.
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>