EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login
Home Data Science Data Science Tutorials Hive Tutorial How To Install Hive
Secondary Sidebar
Hive Tutorial
  • Basics
    • Hive JDBC Driver
    • What is a Hive
    • Hive Architecture
    • Hive Installation
    • How To Install Hive
    • Hive Versions
    • Hive Commands
    • Hive Data Types
    • Hive Built-in Functions
    • Hive Function
    • Hive String Functions
    • Date Functions in Hive
    • Hive Table
    • Hive Drop Table
    • Hive Show Tables
    • Hive Group By
    • Hive Order By
    • Hive Cluster By
    • Joins in Hive
    • Hive Inner Join
    • Map Join in Hive
    • Hive nvl
    • Hive UDF
    • Dynamic Partitioning in Hive
    • HiveQL
    • HiveQL Queries
    • HiveQL Group By
    • Partitioning in Hive
    • Bucketing in Hive
    • Views in Hive
    • Indexes in Hive
    • External Table in Hive
    • Hive TimeStamp
    • Hive Database
    • Hive Interview Questions
    • Hive insert into

Related Courses

Hive Certification Course

Hadoop Course Training

All in One Data Science Course

How To Install Hive

By Priya PedamkarPriya Pedamkar

How To Install Hive

How To Install Hive?

Prior Requirement to Install Hive

As I said earlier, it’s very important to understand Apache hive runs on top of the Hadoop Ecosystem and Hadoop Should be up and running with all demons.

Some of the basic Hadoop demons are as follows:

  • Name node
  • Data node
  • Resource manager
  • Node manager

To check the Hadoop version, below is the command:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (86,354 ratings)

Type → Hadoop version in command prompt it will give you the version of Hadoop.

To check the Hadoop cluster report trigger below command:

Type →Hadoop dfsadmin –report in command prompt it will give you the whole cluster report if your server is running.

If Hadoop is not installed on your machine requesting you to please follow the apache instruction to install Hadoop on your system.

I hope java has been installed already on your system as well. to check the java version, please refer to below screenshot.

Check java version

Steps To Install Hive on Ubuntu

Below are the steps to install Hive on Ubuntu are as follows:

Step 1: Hive tar we can download by using the below command in the terminal we can directly download from the terminal as well.

Command: we get http://archive.apache.org/dist/hive/hive-2.1.0/apache-hive-2.1.0-bin.tar.gz

Step 2: Extract the tar file; using the below command in the terminal, we can directly extract the tar above the downloaded tar hive tar file.

Command: tar -xzf apache-hive-2.1.0-bin.tar.gz

I will suggest you verify with ls command about extracted hive file.

Step 3: Edit the “.bashrc” file to update the environment variables for the user.

Command: sudo the .bashrc

Add the following at the end of the file:

# Set HIVE_HOME

Command 1

Execute the below-given command to complete the changes work in the current terminal.

Command: source .bashrcCommand 2

 Step 5: We need to create Hive directories within the HDFS location. This directory ‘warehouse’ will be the location to store the metadata related information of the hive table and data related to Hive.

Command:

  • hdfs dfs -mkdir -p /user/hive/warehouse
  • hdfs dfs -mkdir /tmp

Step 6: To set the read and write permission for the hive table execute the below command.

Command:

In the below command, providing write permission to the user group:

  • hdfs dfs -chmod g+w /user/hive/warehouse
  • hdfs dfs -chmod g+w /tmp

 Configuring Hive: It’s very important to point of install hive to configure with Hadoop. We need to edit hive-env.sh, a file which is placed in the $HIVE_HOME/conf directory. The following commands redirect to Hive conf folder and copy the template file:

Step 7: Set a Hadoop path in hive-env.sh

Hive Installation 4

Edit the hive-env.sh file by appending the following line:

Hive Installation 5

Now by this process, we are almost done and the hive installations have been completed successfully it’s important to configure Metastore with the external database server and by default, Apache Hive framework uses Derby database. By using below command Initializing Derby database.

Command: bin/schematool -initSchema -dbType derby

Step 8: Launch Hive.

Command: hive (type hive in the terminal within second hive terminal will open.)

Working with Hive: Now we will see some of the operations in the hive to see how many tables we have in default database use refer below screenshots in the below screenshots it’s not showing any tables means we don’t have any tables in the default database.

 Hive Installation 6

To create a table in the hive it’s very important to refer required database otherwise any table will get created under the default database.

Important commands in Hive

1: show databases (it will show all databases that have been created till yet).

2: create the database if not exists mydb (this command will create one database with the name of ‘mydb’ if ‘mydb’ not exists and if ‘mydb already exists it will not give any error as well’)

3: use database whenever we have to use some DDL command on the particular database we should use the command “use database” in our case we have already created “mydb” show command would be used mydb.

Important Hive DDL command

CREATE, DROP, TRUNCATE, SHOW, DESCRIBE.

  • Create: – Create a statement used to create a database or create a table in a hive.

Example: hive> create database Company; (database create)

Hive>use Company;

Hive> create table employee (id int, name String, salary String); (this will create table employee under database Company because we have already executed the command Use database.)

  • Describe provides information about the schema of the table.

Hive>describe employee; (this will give the schema details of employee table in details)

  • TRUNCATE will delete the data of the table.

Hive> truncate table employee;

We can Install the Hive on a window as well, but for best practice, I will prefer Ubuntu to use, it will give a better view of productions environment and your data will increase in the future it will easy to manage.

Recommended Articles

This has been a guide to Install Hive. Here we have discussed the different steps to install Hive, DDL command etc. You may also look at the following articles to learn more:

  1. How to Install SQL Server
  2. How to Install MATLAB
  3. Hive Commands and Feature
  4. Hive Installation
Popular Course in this category
Hive Training (2 Courses, 5+ Projects)
  2 Online Courses |  5 Hands-on Projects |  25+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes)4.9
All in One Data Science Bundle (360+ Courses, 50+ projects)4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more