Hadoop Installation on Windows WSL 2 on Ubuntu 20.04 LTS (Single Node). Vikas Sharma. Jan 20, 2022. Medium.com

image

On opening WSL2:

sudo service ssh restart
start-all.sh

Change /usr/local/hadoop/etc/hadoop/hdfs-site.xml configuration to following:

<configuration>
 <property>
 <name>dfs.namenode.name.dir</name>
 <value>file:///usr/local/hadoop/hdfs/namenode</value>
 <description>NameNode directory for namespace and transaction logs storage.</description>
 </property>
 <property>
 <name>dfs.datanode.data.dir</name>
 <value>file:///usr/local/hadoop/hdfs/datanode</value>
 <description>DataNode directory</description>
 </property>
 <property>
 <name>dfs.replication</name>
 <value>2</value>
 </property>
 <property>
   <name>dfs.namenode.ssh.port</name>
   <value>22</value>
 </property>
</configuration>
hdfs namenode -format
start-dfs.sh
start-yarn.sh
stop-all.sh
start-all.sh

HDFS: Going to http://localhost:9870 in browser:

image

YARN: Going to http://localhost:8088 in browser:

image

hdfs dfs -mkdir /user
hdfs dfs -chmod 755 /user
hdfs dfs -mkdir /user/jordan
echo "Hello, Hadoop!" > testfile.txt
hdfs dfs -put testfile.txt /user/jordan/