Apache Hive Installation on Ubuntu

Apache hive installation on ubuntu

Steps to start Apache Hive 3.x installation on Ubuntu

So to start the installation process. Firstly, we need to download the up-to-date stable release from (http://apachemirror.wuchna.com/hive/hive-3.1.2/), for older versions visit (http://apachemirror.wuchna.com/hive/).

cd /usr/localsudo wget http://apachemirror.wuchna.com/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz
sudo tar xvzf apache-hive-3.1.2-bin.tar.gz
sudo mv apache-hive-3.1.2-bin hive

Next step is the addition of Hive Environment Variables

Here, the hive path needs to added to the environment, or else you would need to run commands using the hive directory.

sudo nano ~/.bashrc
# Set HIVE_HOMEexport HIVE_HOME=/usr/local/hiveexport PATH=$PATH:$HIVE_HOME/bin
source ~/.bashrc
hdfs dfs -mkdir /bigdata/tmp
hdfs dfs -mkdir -p /bigdata/hive/warehouse
hdfs dfs -chmod g+w /bigdata/tmphdfs dfs -chmod g+w /bigdata/hive/warehouse

Steps to configuring the Hive …

Convert working directory to hive configuration locations using the below commands.

cd /usr/local/hive/conf
sudo nano hive-env.sh
# Set HADOOP_HOME to point to a specific hadoop install directoryexport HADOOP_HOME=/usr/local/hadoop# Hive Configuration Directory can be controlled by:export HIVE_CONF_DIR=/usr/local/hive/conf# Java Homeexport JAVA_HOME=/usr

Metastore Configuration

Metastore is the primary central repository of the Apache Hive metadata. It is programmed to store metadata for Hive tables (just like their schema and directory location) and then partitions are made in a relational database.

sudo apt-get updatesudo apt-get install mysql-server
sudo mysql_secure_installation utility
sudo systemctl start mysql
sudo systemctl enable mysql
sudo apt-get install libmysql-java
ln -s /usr/share/java/mysql-connector-java.jar $HIVE_HOME/lib/mysql-connector-java.jar
mysql -u root -p
CREATE DATABASE metastore;USE metastore;SOURCE /usr/local/hive/scripts/metastore/upgrade/mysql/hive-schema-3.1.0.mysql.sql;
CREATE USER ‘hiveuser’@’%’ IDENTIFIED BY ‘hivepassword’;GRANT all on *.* to ‘hiveuser’@localhost identified by ‘hivepassword’;flush privileges;
cd /usr/local/hive/confsudo nano hive-site.xml
<configuration><property><name>javax.jdo.option.ConnectionURL</name><value>jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true</value><description>metadata is stored in a MySQL server</description></property><property><name>javax.jdo.option.ConnectionDriverName</name><value>com.mysql.jdbc.Driver</value><description>MySQL JDBC driver class</description></property><property><name>javax.jdo.option.ConnectionUserName</name><value>hiveuser</value><description>user name for connecting to mysql server</description></property><property><name>javax.jdo.option.ConnectionPassword</name><value>password</value><description>hivepassword for connecting to mysql server</description></property></configuration>
hive

Extras …

Also if you are able to get into the hive console without any errors, you may then verify your metastore configuration by following the below steps.

create table test(id int, name string);
mysql -u root -p
use metastore;select * from TBLS;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Accubits Technologies Inc

Accubits Technologies Inc

31 Followers

Accubits Technologies is an enterprise solutions development company focusing on AI and Blockchain technologies, based in Virginia, USA. https://accubits.com/