How To Install Apache Hadoop on RHEL 8 (Single Node Cluster)


Apache Hadoop is a free, open-source software framework written in Java for distributed storage and processing of big data using the MapReduce. It handles the very large size of data sets by splitting them into large blocks and distributes them across computers in a cluster.

Rather than relying on standard OS clusters, Hadoop modules are designed to detect and manage the failure at the application layer and gives you high-available service at the software level.

The base Hadoop framework consists of following modules,

  • Hadoop Common – Contains common set of libraries and utilities to support other Hadoop modules
  • Hadoop Distributed File System (HDFS) – Java-based distributed file system that stores data on standard hardware, providing very high-throughput to the application.
  • Hadoop YARN – Manages resources on compute clusters and using them scheduling user’s applications.
  • Hadoop MapReduce – Framework for large-scale data processing based on the MapReduce programming model.

In this post, we will see how to install Apache Hadoop on RHEL 8.


Switch to the root user.

su -


sudo su -

Apache Hadoop v3.1.2 supports only Java version 8. So, install either OpenJDK 8 or Oracle JDK 8.

In this demo, I will use OpenJDK 8.

yum -y install java-1.8.0-openjdk wget

Check the Java version.

java -version


openjdk version "1.8.0_201"
OpenJDK Runtime Environment (build 1.8.0_201-b09)
OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)

Install Apache Hadoop on RHEL 8

Create Hadoop user

It is recommended to run Apache Hadoop by a regular user. So, here, we will create a user named hadoop and set a password for the user.

useradd -m -d /home/hadoop -s /bin/bash hadoop

passwd hadoop

Now, configure passwordless ssh to the local system by following the below steps.

# su - hadoop

$ ssh-keygen

$ cat ~/.ssh/ >> ~/.ssh/authorized_keys

$ chmod 600 ~/.ssh/authorized_keys

Verify the passwordless communication to your local system.

$ ssh


If you are connecting through ssh for the first time, you would need to type yes to add RSA keys to known hosts.

[hadoop@rhel8 ~]$ ssh
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:85jUAgtJg8RLOqs8T2egxF7U7IWIiYF+CRspO8yatAk.
Are you sure you want to continue connecting (yes/no)? Yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Wed May 8 12:15:04 2019 from
[hadoop@rhel8 ~]$

Download Hadoop

Visit Apache Hadoop page to download the latest version of Apache Hadoop (Always choose the version which is production ready by checking the documentation), or you can use the following command in terminal to download Hadoop v3.1.2.

$ wget

$ tar -zxvf hadoop-3.1.2.tar.gz 

$ mv hadoop-3.1.2 hadoop

Hadoop Cluster Types

There are three types of Hadoop clusters:

  1. Local (Standalone) Mode – It runs as a single java process.
  2. Pseudo-Distributed Mode – Each Hadoop daemon runs as a separate process.
  3. Fully Distributed Mode – a multinode cluster. Ranging from few nodes to an extremely large cluster.

Setup environmental variables

Here, we will configure Hadoop in Pseudo-Distributed mode. First, we will set environmental variables in the ~/.bashrc file.

Change JAVA_HOME and HADOOP_HOME variable entries in the file depending upon your environment.
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-
export HADOOP_HOME=/home/hadoop/hadoop

Apply environmental variables to your current terminal session.

$ source ~/.bashrc

Configure Hadoop

Edit the Hadoop environmental file and update the variable as shown below.

$ vi $HADOOP_HOME/etc/hadoop/

Update JAVA_HOME variable as per your environment.

export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-

We will now edit Hadoop’s configuration files depending upon the cluster mode we set up (Pseudo-Distributed).

$ cd $HADOOP_HOME/etc/hadoop

Edit core-site.xml and update the file with HDFS hostname.


Create the namenode and datanode directories under hadoop user home /home/hadoop directory.

$ mkdir -p ~/hadoopdata/hdfs/{namenode,datanode}

Edit hdfs-site.xml and update the file with NameNode and DataNode directory information.




Edit mapred-site.xml.


Edit yarn-site.xml.


Format the NameNode using the following command.

$ hdfs namenode -format


.    .    .
.    .    .

2019-05-13 19:33:14,720 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1601223288-
2019-05-13 19:33:15,100 INFO common.Storage: Storage directory /home/hadoop/hadoopdata/hdfs/namenode has been successfully formatted.
2019-05-13 19:33:15,436 INFO namenode.FSImageFormatProtobuf: Saving image file /home/hadoop/hadoopdata/hdfs/namenode/current/fsimage.ckpt_0000000000000000000 using no compression
2019-05-13 19:33:16,804 INFO namenode.FSImageFormatProtobuf: Image file /home/hadoop/hadoopdata/hdfs/namenode/current/fsimage.ckpt_0000000000000000000 of size 393 bytes saved in 1 seconds .
2019-05-13 19:33:17,106 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
2019-05-13 19:33:17,150 INFO namenode.NameNode: SHUTDOWN_MSG:
SHUTDOWN_MSG: Shutting down NameNode at rhel8.itzgeek.local/


Run below commands to allow Apache Hadoop connections through the firewall. Run these commands as the root user.

firewall-cmd --permanent --add-port=9870/tcp
firewall-cmd --permanent --add-port=8088/tcp
firewall-cmd --reload

Start Hadoop & Yarn

Start both NameNode and DataNode daemons by using the scripts provided by Hadoop.



Starting namenodes on [rhel8.itzgeek.local]
rhel8.itzgeek.local: Warning: Permanently added 'rhel8.itzgeek.local,fe80::4480:83a5:c52:ea80%enp0s3' (ECDSA) to the list of known hosts.
Starting datanodes
localhost: Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Starting secondary namenodes [rhel8.itzgeek.local]
2019-05-13 19:39:00,698 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Open a browser and go to the below address to access Namenode.
Install Apache Hadoop on RHEL 8 - Hadoop NameNode Information
Install Apache Hadoop on RHEL 8 – Hadoop NameNode Information

Start the ResourceManager and NodeManagers.



Starting resourcemanager
Starting nodemanagers

Open a browser and go to the below address to access ResourceManager.
Install Apache Hadoop on RHEL 8 - ResourceManager
Install Apache Hadoop on RHEL 8 – ResourceManager

Test Apache Hadoop

We will now test the Apache Hadoop by uploading a sample file on to it. Before uploading a file to HDFS, create a directory in HDFS.

$ hdfs dfs -mkdir /raj

Verify that the created directory exists in HDFS.

hdfs dfs -ls /


Found 1 items
drwxr-xr-x   - hadoop supergroup          0 2019-05-08 13:20 /raj

Upload a file into HDFS directory raj with the following command.

$ hdfs dfs -put ~/.bashrc /raj

Uploaded files can be viewed by running below command.

$ hdfs dfs -ls /raj


Go to NameNode >> Utilities >> Browse the file system in NameNode.
Install Apache Hadoop on RHEL 8 - Browse Hadoop FileSystem
Install Apache Hadoop on RHEL 8 – Browse Hadoop FileSystem

You can copy the files from HDFS to your local file systems by using the below command.

$ hdfs dfs -get /raj /tmp/

If required, you can delete the files and directories in HDFS using the following commands.

$ hdfs dfs -rm -f /raj/.bashrc

$ hdfs dfs -rmdir /raj


I hope, this post helped you to install and configure a single node Apache Hadoop cluster on RHEL 8. You can read Hadoop’s official documentation for more information. Please share your feedback in the comments section.

You might also like