Install Hbase in CentOS and Ubuntu

created at 08-06-2021 views: 12

It is recommended to install the new version of the small partners to look at the corresponding relationship first, so as to avoid incompatibility between jdk and hbase

Compatibility between jdk and Hbase:

Compatibility between jdk and Hbase

1. Download and unzip the installation file


tar xvfz hbase-2.2.5-bin.tar.gz

2. Start HBase


If an error is reported like:

| Error: JAVA_HOME is not set and Java could not be found |
| Please download the latest Sun JDK from the Sun Java web site |
| > < |
| |
| Hadoop requires Java 1.6 or later. |
| NOTE: This script will find Sun Java whether you install using the |
| binary or the RPM based installer. |

Need to modify the HBase configuration file, the configuration file is in the conf/ folder

vi conf/

Add the location of the JDK, take my machine as an example, the JDK is placed under /usr/lib/jdk:


It should be noted that the JDK needs to be installed by yourself. If the system already has its own JDK, it is better to delete it and install it again. Otherwise, it is useless to modify the configuration file to start!

Uninstall openjdk under CentOS

1. View the java version

[root@CFDB2 ~]# java -version

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)

2. View the java installation software

[root@CFDB2 ~]# rpm -qa|grep java


[root@CFDB2 ~]#

3. Uninstall openjdk

# .noarch does not need to be deleted
rpm -e --nodeps java-1.8.0-openjdk-headless-

Uninstall openjdk under Ubuntu

sudo apt-get remove openjdk*

install jdk

The steps to install jdk are the same

step 1. Download the corresponding jdk version

go to oracle 

step 2. Copy the decompressed folder to the /usr/lib/jdk/ directory, if there is no jdk folder here, create the folder under /usr/lib

cd /usr/lib
mkdir jdk
tar zxvf ./jdk-8u301-linux-x64.tar.gz -C /usr/lib/jdk
cd /cd ./jdk1.8.0_301

step 3. Set environment variables

Open the /etc/profile file

vim /etc/profile

You can add the following two types at the end of the file:

export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_301
export JRE_HOME=/usr/lib/jdk/jdk1.8.0_301/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_301
export JRE_HOME=/usr/lib/jdk/jdk1.8.0_301/jre
export PATH=$PATH:$JAVA_HOME/bin/

4. Modify the default JDK of the system (if you have not installed other JDKs before, you can skip this step)

update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.8.0_161/bin/java 300

update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.8.0_161/bin/javac 300

update-alternatives --config java

update-alternatives --config javac

5. Re-check the java version

java -version

Restart HBase after configuring jdk


If the startup is successful, there will be the following prompt message:

running master, logging to /home/lyl/taiji/hbase/hbase-2.2.7/bin/../logs/hbase-root-master-lyl-ThinkServer-TS80X.out

The browser enters the following URL to open the hbase client


xx.xx.xx.xx is the ip address of the server installed by yourself, each server is different

hbase client

If hbase is started successfully, the browser cannot access the client, please turn off the server firewall and visit again

  • CentOS turns off the firewall: systemctl stop firewalld.service
  • Ubuntu turns off the firewall: sudo ufw disable
created at:08-06-2021
edited at: 08-06-2021: