Install Hive on Ubuntu

Configuration

My configuration is Apache Hive 0.13.0 on machine with Ubuntu 14.04 and  Apache Hadoop 2.2.0

(About Hadoop installation – http://dmitrypukhov.pro/install-hadoop-on-ubuntu)

Download and unpack Hive

Download latest Hive release from Apache web site http://www.apache.org/dyn/closer.cgi/hive/

Unpack to /opt/hive folder. Change owner to Hadoop user and group, hduser and hadoop in my case

$ sudo chown -R hduser:hadoop /opt/hive

Configure environment variables 

Edit /etc/environment ( $ sudo nano /etc/environment)

add line
HIVE_HOME=/opt/hive
and also add /opt/hive/bin to the PATH variable
PATH="..some previous values...  :/opt/hive/bin"

Create folders in Hadoop file system

$ $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

Run Hive, ensure installation

Hive CLI:

Enter as hadoop user and run Hive CLI: 

$ su hduser
$ hive

Try simple command to test:
> show tables;
Don’t forget semicolon after command 🙂 Press Ctrl+C to exit Hive

Starting HiveServer1

$ /opt/hive/bin/hive --service hiveserver

Starting HiveServer2

$ /opt/hive/bin/hiveserver2

 

One thought on “Install Hive on Ubuntu

  1. Nitya

    I am stuck with creating folders in HDFS.
    Getting the following error : WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
    and also while running hive,am getting folllowing error:
    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/hive/ql/CommandNeedRetryException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:344)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:205)
    Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.ql.CommandNeedRetryException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    … 3 more
    Please help me.

    Reply

Leave a Reply to Nitya Cancel reply

Your email address will not be published.