How to Install HDFS on Manjaro
In this tutorial, we will go through the steps of installing HDFS on Manjaro. HDFS is a part of the Apache Hadoop project and is used for storing and processing large datasets. Follow the instructions below to get started.
Prerequisites
Before we begin, ensure that you have the following prerequisites.
- Manjaro installed on your system
- Java 8 or later installed on your system
Installing Hadoop
Follow the steps below to install Hadoop on your Manjaro system.
Download the latest stable release of Hadoop from the Apache Hadoop website. You can download it using the following command in your terminal.
wget https://downloads.apache.org/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gzExtract the downloaded archive using the following command.
tar -xzf hadoop-3.3.1.tar.gzMove the extracted archive to the
/opt/directory using the following command.sudo mv hadoop-3.3.1 /opt/Set the
HADOOP_HOMEenvironment variable by adding the following line to your.bashrcfile.export HADOOP_HOME=/opt/hadoop-3.3.1You can open
.bashrcusing the following command.nano ~/.bashrcRefresh your environment variables using the following command.
source ~/.bashrc
Configuring Hadoop
Follow the steps below to configure Hadoop.
Create a directory for Hadoop to store its data files using the following command.
mkdir -p /opt/hadoop-3.3.1/data/hdfs/namenode mkdir -p /opt/hadoop-3.3.1/data/hdfs/datanodeEdit the
hadoop-env.shfile using the following command.nano $HADOOP_HOME/etc/hadoop/hadoop-env.shAdd the following line at the end of the file and save it.
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64Edit the
core-site.xmlfile using the following command.nano $HADOOP_HOME/etc/hadoop/core-site.xmlAdd the following lines between the
configurationtags and save the file.<property> <name>fs.defaultFS</name> <value>hdfs://localhost:9000</value> </property>Edit the
hdfs-site.xmlfile using the following command.nano $HADOOP_HOME/etc/hadoop/hdfs-site.xmlAdd the following lines between the
configurationtags and save the file.<property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/opt/hadoop-3.3.1/data/hdfs/namenode</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/opt/hadoop-3.3.1/data/hdfs/datanode</value> </property>Edit the
mapred-site.xmlfile using the following command.nano $HADOOP_HOME/etc/hadoop/mapred-site.xmlAdd the following lines between the
configurationtags and save the file.<property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.application.classpath</name> <value>/opt/hadoop-3.3.1/share/hadoop/mapreduce/*:/opt/hadoop-3.3.1/share/hadoop/mapreduce/lib/*</value> </property>Edit the
yarn-site.xmlfile using the following command.nano $HADOOP_HOME/etc/hadoop/yarn-site.xmlAdd the following lines between the
configurationtags and save the file.<property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property>
Formatting the NameNode
Before starting HDFS, you need to format the NameNode. Follow the instructions below to format the NameNode.
Run the following command in your terminal.
hdfs namenode -format
Starting and Stopping HDFS
Follow the steps below to start and stop HDFS.
To start HDFS, run the following command in your terminal.
start-dfs.shTo stop HDFS, run the following command in your terminal.
stop-dfs.sh
Congratulations! You have successfully installed HDFS on your Manjaro system. You can now start using HDFS for storing and processing large datasets.