Over a million developers have joined DZone.

How to Install Pig & Hive on Linux Mint VM

DZone's Guide to

How to Install Pig & Hive on Linux Mint VM

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

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

Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}