Hive Installation

Posted on by Sumit Kumar

Hive installation:

1.) search for apache hive-2.2.0 bin in google
and download zar file (latest bin.tar.gz file)

e.g. :- apache-hive-2.2.0-bin.tar.gz

or download hive from linux command as below:–


2.) extract file:
tar -xvf <filename>

e.g.:-tar -xvf apache-hive-2.2.0-bin.tar.gz

mv apache-hive-2.2.0-bin hive2

3.) download mysqlconnector by using below command


extract file :
tar -xvf mysql-connector-java-5.1.45.tar.gz

copy mysql-connector-java-5.1.45-bin.jar to lib directory in Hive

4.)go to hive2>>>>lib folder
Delete log4j-slf4j-impl-2.4.1.jar jar file from lib directory which is under apache-hive-2.2.0-bin (hive2)directory

5.) hdfs dfs -mkdir -p /user
hdfs dfs -mkdir -p /user/hive
hdfs dfs -mkdir -p /user/hive/warehouse

hdfs dfs -mkdir -p /tmp
hdfs dfs -mkdir -p /tmp/hive

6:- Change Dirctory Permissions

$hdfs dfs -chmod 777 /tmp/
$hdfs dfs -chmod 777 /user/hive/warehouse
$hdfs dfs -chmod 777 /tmp/hive

7.) install mysql:

sudo apt-get install mysql-server

8.) create database metastore

$ mysql -u root -p
{mysql> CREATE DATABASE metastore_db;
mysql> use metastore_db;

/* Now you need to run the script , for that you have to specify the location of script file on your system*/
mysql> SOURCE /home/aru/hive2/scripts/metastore/upgrade/mysql/hive-schema-0.14.0.mysql.sql;}
9:- Create Hiveuser and Hivepassword
mysql> CREATE USER ‘hiveuser’@’%’ IDENTIFIED BY ‘hivepassword’;
mysql> GRANT all on *.* to ‘hiveuser’@localhost identified by ‘hivepassword’;
mysql> flush privileges;

10 :- Get into conf directory under apache-hive-2.2.0-bin folder and rename hive-default.xml.template to hive-site.xml and to

1. In (append HADOOP_HOME at end of file)

export HADOOP_HOME=/home/aru/hadoop2

2. In hive-site.xml (/home/username/hive/conf)

Change following properties
a) ConnectionURL


b) ConnectionUserName
c) ConnectionPassword


=============or copy paste below configuration into hive-site.xml==============

<description>metadata is stored in a MySQL server</description>
<description>MySQL JDBC driver class</description>
<description>user name for connecting to mysql server</description>
<description>password for connecting to mysql server</description>

===========Note :-change UserName and Passoword===================

3. Replace following values in hive-site.xml

<description>Local scratch space for Hive jobs</description>
<description>Temporary local directory for added resources in the remote file system.</description>


Step 11:- Set Path in bashrc
$sudo gedit ~/.bashrc
Add these lines at end of file
export HIVE_HOME=/home/aru/hive2
export PATH=$PATH:$HIVE_HOME/bin:$HIVE_HOME/conf

exec bash

step 12 :- $schematool -initSchema -dbType mysql

Step 13 :- $hive

Note:–Before starting hive please verify , All hadoop services should up and running fine
sumit@hadoop:~$ jps

15521 NameNode
15850 NodeManager
15724 ResourceManager
19325 DataNode

About ATI Base Author: Sumit Kumar

Author of Hadoop tutorial View all posts by Sumit Kumar →

Got Something To Say:

Your email address will not be published. Required fields are marked *



Planet Polaris

Website Support
website support at Planet Polaris