Start by downloading the latest stable release from https://hive.apache.org/downloads.html
-> Now untar the file with
$ tar -xvf hive-2.x.y-bin.tar.gz
-> Create a directory in the /usr/local/ with
$ sudo mkdir /usr/local/hive
-> Move the file to root with
$ mv ~/Downloads/hive-2.x.y /usr/local/hive
-> Edit environment variablesfor hadoop and hive in .bashrc
$ gedit ~/.bashrc
like this
export HIVE_HOME=/usr/local/hive/apache-hive-2.0.1-bin/
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:/usr/local/Hadoop/lib/*:.
export CLASSPATH=$CLASSPATH:/usr/local/hive/apache-hive-2.0.1-bin/lib/*:.
-> Now, start hadoop if it is not already running. And make sure that it is running and it is not in safe mode.
$ hadoop fs -mkdir /user/hive/warehouse
The directory "warehouse" is the location to store the table or data related to hive.
$ hadoop fs -mkdir /tmp
The temporary directory “tmp” is the temporary location to store the intermediate result of processing.
-> Set Permissions for read/write on those folders.
$ hadoop fs -chmod g+w /user/hive/warehouse
$ hadoop fs -chmod g+w /user/tmp
-> Now fire up HIVE with this command in console
$ hive