This tutorial is tested on Ubuntu

First of we need to install and configure Hadoop on system. Use the following link to install Hadoop on Ubuntu:


#Download Hive from

# Copy and extract apache-hive-1.2.2-bin.tar.gz in home folder

# Rename the extracted folder name from apache-hive-1.2.2 to hive

# remember your user name

# Set the environment variables
gedit .bashrc

# add following lines at the end CHANGE YOUR_USER_NAME

export PATH="/home/your_user_name/hadoop/bin:$PATH" 
export PATH="/home/your_user_name/hadoop/sbin:$PATH" 
export PATH="/home/your_user_name/hive/bin:$PATH" 

# save and exit the file

#then add below line in terminal
 source .bashrc

# verify the PATH variable
echo $PATH

# start DFS
 ~/hadoop/sbin/ jps

#Make Directories for Hive
~/hadoop/bin/hadoop fs -mkdir /tmp
~/hadoop/bin/hadoop fs -mkdir /user
~/hadoop/bin/hadoop fs -mkdir /user/hive
~/hadoop/bin/hadoop fs -mkdir /user/hive/warehouse

#Add these lines
~/hadoop/bin/hadoop fs -chmod g+w /tmp
~/hadoop/bin/hadoop fs -chmod g+w /user/hive/warehouse

#DONE Run Hive CLI

# Creating Hive Table 
hive> CREATE TABLE student (roll INT, name STRING);

# show all tables 

# show tables that end with ‘t’ 
hive> SHOW TABLES '.*t';

# show the list of columns of a table 
hive> DESCRIBE student;

# change the table name
hive> ALTER TABLE student RENAME TO student1;

# add new column to a table 
hive> ALTER TABLE student1 ADD COLUMNS (marks INT);
hive> DESCRIBE student1;

 # drop table 
hive> DROP TABLE student1;

# quit Hive CLI 
 hive> quit;

# Stop hadoop