How to install Pig & Hive on Linux Mint VM


First lets start with Hive

Running Hive

Hive uses Hadoop, so:

  • you must have Hadoop in your path OR
  • export HADOOP_HOME=<hadoop-install-dir>

In addition, you must create /tmp and /user/hive/warehouse (aka hive.metastore.warehouse.dir) and set them chmod g+w in HDFS before you can create a table in Hive.

Commands to perform this setup:

  $ $HADOOP_HOME/bin/hadoop fs -mkdir       /tmp
  $ $HADOOP_HOME/bin/hadoop fs -mkdir       /user/hive/warehouse
  $ $HADOOP_HOME/bin/hadoop fs -chmod g+w   /tmp
  $ $HADOOP_HOME/bin/hadoop fs -chmod g+w   /user/hive/warehouse

You may find it useful, though it’s not necessary, to set HIVE_HOME:

  $ export HIVE_HOME=<hive-install-dir>

Installing Hive

  • Download a recent stable release from one of the Apache Download Mirror

$ wget http://apache.sunsite.ualberta.ca/hive/hive-0.12.0/

  • extract the downloaded file

$ tar -xzvf hive-0.12.0-bin.tar.gz

  • move the extracted files into new folder (optional)

$ mv hive-0.12.0-bin hive

  • navigate to hive  directory and add the hive installation directory into classpath

$ cd hive

$ pwd
$ export HIVE_HOME=/home/hduser/hive

$ export PATH=$HIVE_HOME/bin:$PATH

  • start hive by typing , run show tables; command to make sure hive is running

$ hive

Now, lets install Pig 

1. Download a recent stable release from one of the Apache Download Mirrors

$ wget http://apache.mirror.iweb.ca/pig/pig-0.12.0/pig-0.12.0.tar.gz

2.Unpack the downloaded Pig distribution, a

$ tar -xzvf pig-0.12.0.tar.gz

3.move directory (optional)

$ mv pig-0.12.0 pig

4.go to pig installation directory

$ cd pig

5. add pig installation directory to classpath

$ pwd

/home/hduser/pig

$ export PIG_HOME=/home/hduser/pig

$ export PATH=$PIG_HOME/bin:$PATH

6. Test the pig installation with simple command
$pig -help

Advertisements

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