Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Databases

Set up a single-node Hadoop 3.5 cluster on Ubuntu

Install Hadoop 3.5 on Ubuntu 24.04 or 26.04 as a single-node cluster: Java 17, HDFS and YARN configuration, a first MapReduce job and safe web UI access.

CloudSat teamNovember 18, 20267 min read
Rows of translucent stacked blocks on a single platform, each row linked by thin lines to one bright central node.
On this pageWhat you will run

Apache Hadoop 3.5.0, released in April 2026, is the first Hadoop release with full Java 17 support, and its server side now requires Java 17. A single-node setup, which the Hadoop docs call pseudo-distributed mode, runs every daemon on one machine. It is the quickest way to learn HDFS, YARN and MapReduce, or to test a job before it meets a real cluster. It is not a place for production data: one disk and one copy of every block means one failure loses everything.

What you will run

Daemon Layer What it does Web UI port
NameNode HDFS Keeps the filesystem tree and block locations 9870
DataNode HDFS Stores the blocks themselves 9864
SecondaryNameNode HDFS Merges metadata checkpoints 9868
ResourceManager YARN Schedules applications across the cluster 8088
NodeManager YARN Runs application containers on this node 8042

How HDFS stores a file

HDFS splits every file into large blocks, 128 MB by default, and stores each block on DataNodes. The NameNode never holds file contents: it keeps the directory tree and the map of which DataNode holds which block, in memory, which is why NameNode RAM limits how many files a cluster can track. On a real cluster each block is copied to three DataNodes, so losing one machine loses nothing. YARN is the second half: it hands out slices of CPU and memory, called containers, to applications such as MapReduce or Spark jobs, and tries to run work on the node that already holds the data.

Before you start

You need Ubuntu 24.04 or 26.04 with root access and at least 4 GB of RAM, which leaves room for all five daemons plus a small job. A 4 GB Cloud VPS at $11.58/mo fits this lab, and because servers bill by the hour, deleting it after a weekend of practice costs only the hours it ran. Everything below runs as a dedicated hadoop user, never as root.

Step 1: install Java 17 and create the user

OpenJDK 17 is packaged for both Ubuntu releases. Hadoop's start scripts reach every node over SSH, even when the only node is localhost, so the SSH server must be present too:

sudo apt update
sudo apt install -y openjdk-17-jdk-headless openssh-server
sudo useradd -m -s /bin/bash hadoop

Step 2: download and verify Hadoop

Download the release from the Apache CDN, but take the checksum from the main Apache download site, so a tampered mirror cannot serve both:

cd /tmp
wget https://dlcdn.apache.org/hadoop/common/hadoop-3.5.0/hadoop-3.5.0.tar.gz
wget https://downloads.apache.org/hadoop/common/hadoop-3.5.0/hadoop-3.5.0.tar.gz.sha512
sha512sum -c hadoop-3.5.0.tar.gz.sha512
sudo tar -xzf hadoop-3.5.0.tar.gz -C /opt
sudo ln -s /opt/hadoop-3.5.0 /opt/hadoop
sudo chown -R hadoop:hadoop /opt/hadoop-3.5.0

The check must print hadoop-3.5.0.tar.gz: OK. On an ARM server, use hadoop-3.5.0-aarch64.tar.gz and its own .sha512 file.

Step 3: set up the environment and SSH

Switch to the new user with sudo -iu hadoop, then give it a key that lets it log in to itself without a password:

ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh -o StrictHostKeyChecking=accept-new localhost true

If your SSH configuration restricts logins with AllowUsers, add hadoop there first. Next, set the paths for your shell, and write JAVA_HOME into Hadoop's own environment file, because daemons started over SSH do not read ~/.bashrc:

cat >> ~/.bashrc <<'EOF'
export JAVA_HOME=$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")
export HADOOP_HOME=/opt/hadoop
export PATH="$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin"
EOF
source ~/.bashrc
echo "export JAVA_HOME=$JAVA_HOME" >> $HADOOP_HOME/etc/hadoop/hadoop-env.sh
hadoop version

Step 4: configure HDFS and YARN

All four files live in /opt/hadoop/etc/hadoop/. Replace the empty <configuration> element in each. First core-site.xml, which tells clients where the filesystem is:

<configuration>
  <property>
    <name>fs.defaultFS</name>
    <value>hdfs://localhost:9000</value>
  </property>
</configuration>

Then hdfs-site.xml. With one DataNode, keep one copy of each block. The two directory settings matter more than they look: by default, Hadoop keeps its metadata and blocks under /tmp, which Ubuntu can clear at boot, taking your filesystem with it.

<configuration>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
  <property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///home/hadoop/hdfs/namenode</value>
  </property>
  <property>
    <name>dfs.datanode.data.dir</name>
    <value>file:///home/hadoop/hdfs/datanode</value>
  </property>
</configuration>

Then mapred-site.xml, which runs MapReduce on YARN:

<configuration>
  <property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
  </property>
  <property>
    <name>mapreduce.application.classpath</name>
    <value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*</value>
  </property>
</configuration>

Finally yarn-site.xml. The last property caps the memory YARN hands out. Its default assumes 8 GB, so on a 4 GB server, set it below the real RAM or the kernel's out-of-memory killer will settle the difference:

<configuration>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.env-whitelist</name>
    <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_HOME,PATH,LANG,TZ,HADOOP_MAPRED_HOME</value>
  </property>
  <property>
    <name>yarn.nodemanager.resource.memory-mb</name>
    <value>3072</value>
  </property>
</configuration>

Step 5: format HDFS and start the daemons

Format the NameNode once, then start HDFS and YARN:

hdfs namenode -format
start-dfs.sh
start-yarn.sh
jps

jps should list NameNode, DataNode, SecondaryNameNode, ResourceManager and NodeManager. If one is missing, its log in /opt/hadoop/logs/ says why.

Step 6: run a first job

Copy a few files into HDFS and count their words with the bundled examples. Relative HDFS paths resolve to /user/hadoop:

hdfs dfs -mkdir -p /user/hadoop/input
hdfs dfs -put $HADOOP_HOME/etc/hadoop/*.xml input
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.5.0.jar \
  wordcount input output
hdfs dfs -cat output/part-r-00000 | sort -k2,2nr | head

Run the job a second time and it fails, because MapReduce refuses to overwrite an existing output directory. Remove it first with hdfs dfs -rm -r output. That rule protects real results from being clobbered by a rerun, and it is worth keeping in mind when you script jobs.

Look around the cluster

These commands answer most "what is going on" questions while you learn. The first reports capacity and live DataNodes, the second shows how a file was split into blocks and where they live, and the third lists every YARN application with its final state:

hdfs dfsadmin -report
hdfs fsck /user/hadoop/input -files -blocks -locations
yarn application -list -appStates ALL

Log aggregation is off by default, so the logs of each job's containers stay on this node under /opt/hadoop/logs/userlogs/, one folder per application ID. That is the first place to look when a job fails.

Reach the web UIs safely

The web interfaces listen on all network interfaces by default, and a reachable ResourceManager accepts job submissions through its REST API unless you configure Kerberos. Exposed YARN servers are a well-known target for people looking for free machines to mine on. Allow only SSH in from outside:

sudo ufw allow OpenSSH
sudo ufw enable

Then reach the NameNode and ResourceManager pages from your computer through a tunnel, at http://localhost:9870 and http://localhost:8088:

ssh -N -L 9870:127.0.0.1:9870 -L 8088:127.0.0.1:8088 admin@203.0.113.10

Stop and restart without losing data

stop-yarn.sh and stop-dfs.sh shut everything down, and the data stays in /home/hadoop/hdfs. Never run hdfs namenode -format again on a filesystem you want to keep: it creates a new namespace with a new cluster ID, and the existing DataNode refuses to join it.

Where Hadoop fits now

HDFS and YARN still run large on-premises clusters, and tools such as Hive, HBase and Spark on YARN build on them. Many new projects choose object storage with Spark or Trino instead, an approach covered in this lakehouse and warehouse explainer. A single-node lab still teaches the ideas that carry over everywhere: blocks, replication, data locality and resource scheduling.

FAQ

Which Java version does Hadoop 3.5 need?

Java 17 on servers. Clients can use Java 17 or 21, and Java 11 is no longer supported. If you are stuck on Java 8 or 11, stay on the Hadoop 3.4 line.

Why does start-dfs.sh fail with "Connection refused" errors?

If pdsh is installed, Hadoop's scripts use it, and Ubuntu's pdsh defaults to the old rsh protocol. Add export PDSH_RCMD_TYPE=ssh to hadoop-env.sh, or remove pdsh.

Do I need Hadoop to run Spark?

No. Spark runs in its own standalone mode or on Kubernetes and reads from local disks or object storage. YARN and HDFS are one way to host it, common where a Hadoop cluster already exists.

Can I grow this into a real cluster later?

Yes. Point fs.defaultFS and YARN at the master's hostname instead of localhost, list worker hostnames in etc/hadoop/workers, raise dfs.replication to 3, and copy the configuration to every node.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.