hive Getting started with hive Hive Installation with External Metastore in Linux



  1. Java 7
  2. Hadoop (Refer here for Hadoop Installation)
  3. Mysql Server and Client


Step 1: Download the latest Hive tarball from the downloads page.

Step 2: Extract the downloaded tarball (Assumption: The tarball is downloaded in $HOME)

tar -xvf /home/username/apache-hive-x.y.z-bin.tar.gz

Step 3: Update the environment file (~/.bashrc)

export HIVE_HOME=/home/username/apache-hive-x.y.z-bin
export PATH=$HIVE_HOME/bin:$PATH

source the file to set the new environment variables.

source ~/.bashrc

Step 4: Download the JDBC connector for mysql from here and extract it.

tar -xvf mysql-connector-java-a.b.c.tar.gz

The extracted directory contains the connector jar file mysql-connector-java-a.b.c.jar. Copy it to the lib of $HIVE_HOME

cp mysql-connector-java-a.b.c.jar $HIVE_HOME/lib/


Create the hive configuration file hive-site.xml under $HIVE_HOME/conf/ directory and add the following metastore related properties.

      <description>JDBC connect string for a JDBC metastore</description>
      <description>Driver class name for a JDBC metastore</description>
       <description>username to use against metastore database</description>
       <description>password to use against metastore database</description>



Update the values of MySQL "username" and "password" accordingly in the properties.

Create the Metastore Schema:

The metastore schema scripts are available under $HIVE_HOME/scripts/metastore/upgrade/mysql/

Login to MySQL and source the schema,

mysql -u username -ppassword

mysql> create database hive_meta;
mysql> use hive_meta;
mysql> source hive-schema-x.y.z.mysql.sql;
mysql> exit;

Starting Metastore:

hive --service metastore

To run it in background,

nohup hive --service metastore &

Starting HiveServer2: (Use if required)


To run it in background,

nohup hiveserver2 metastore &

Note: These executables are available under $HIVE_HOME/bin/


Use either hive, beeline or Hue to connect with Hive.

Hive CLI is deprecated, using Beeline or Hue is recommended.

Additional Configurations for Hue:

Update this value in $HUE_HOME/desktop/conf/hue.ini