Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Hadoop on Ubuntu 22.04

Install Java and Hadoop in a single-node setup, set JAVA_HOME and check the version.

VPS and Cloud Servers2 min read3 steps10 screenshots

What Hadoop is

Apache Hadoop is a framework to store and process very large amounts of data across many computers. It scales well, handles many data types and uses cheap hardware.

Step 1: Update the system

sudo apt update
Updating the system

Step 2: Install Java

sudo apt install default-jdk
Installing the JDK

Check the version:

java -version
The Java version

(Hadoop 3.4 runs on Java 8 and Java 11. Java 17 may need extra settings. If the default JDK is too new, install openjdk-11-jdk.)

Step 3: Download Hadoop

Open the Apache Hadoop download page and pick the latest stable release.

The Apache Hadoop download page
wget https://dlcdn.apache.org/hadoop/common/hadoop-3.4.0/hadoop-3.4.0.tar.gz
Downloading Hadoop

Step 4: Extract it

tar -xzvf hadoop-3.4.0.tar.gz
Extracting the archive

Step 5: Move it

sudo mv hadoop-3.4.0 /usr/local/hadoop
Moving Hadoop to /usr/local

Step 6: Find the Java path

readlink -f /usr/bin/java | sed "s:bin/java::"
Finding the Java path

Step 7: Set JAVA_HOME in Hadoop

Open the Hadoop environment file:

sudo nano /usr/local/hadoop/etc/hadoop/hadoop-env.sh

Add (or change) the line, with your Java path:

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
Editing hadoop-env.sh

Or set it from the system value:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")

Step 8: Check Hadoop

/usr/local/hadoop/bin/hadoop version
The Hadoop version

It prints the Hadoop version and build details.

Next steps

To use Hadoop, set HADOOP_HOME and add $HADOOP_HOME/bin to the PATH in ~/.bashrc. Configure core-site.xml, hdfs-site.xml, mapred-site.xml and yarn-site.xml. Set up passwordless SSH to localhost. Format the file system with hdfs namenode -format and start the services with start-dfs.sh and start-yarn.sh.

Why use Hadoop

  1. Scalability. Add machines as your data grows.
  2. Flexibility. It handles structured and unstructured data.
  3. Cost. Runs on commodity hardware.

Quick recap

  • Install Java, download and extract Hadoop to /usr/local/hadoop.
  • Set JAVA_HOME in hadoop-env.sh.
  • Check with hadoop version.