Over a million developers have joined DZone.

How to Install Pig & Hive on Linux Mint VM

· Big Data Zone

Read this eGuide to discover the fundamental differences between iPaaS and dPaaS and how the innovative approach of dPaaS gets to the heart of today’s most pressing integration problems, brought to you in partnership with Liaison.

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


$ export PIG_HOME=/home/hduser/pig

$ export PATH=$PIG_HOME/bin:$PATH

6. Test the pig installation with simple command

 $pig -help

Discover the unprecedented possibilities and challenges, created by today’s fast paced data climate and why your current integration solution is not enough, brought to you in partnership with Liaison


Published at DZone with permission of Hardik Pandya, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}