To install Hadoop, follow these steps:
-
Prerequisites:
- Ensure you have Java installed (Java 8 or later).
- Set the
JAVA_HOMEenvironment variable.
-
Download Hadoop:
wget https://downloads.apache.org/hadoop/common/hadoop-x.y.z/hadoop-x.y.z.tar.gzReplace
x.y.zwith the desired version number. -
Extract the downloaded file:
tar -xzvf hadoop-x.y.z.tar.gz -
Move to the desired directory:
mv hadoop-x.y.z /usr/local/hadoop -
Set environment variables:
Add the following lines to your.bashrcor.bash_profile:export HADOOP_HOME=/usr/local/hadoop export PATH=$PATH:$HADOOP_HOME/bin export JAVA_HOME=/path/to/java -
Source the profile:
source ~/.bashrc -
Configure Hadoop:
Edit the configuration files in the$HADOOP_HOME/etc/hadoopdirectory:core-site.xmlhdfs-site.xmlmapred-site.xmlyarn-site.xml
-
Format the NameNode:
hdfs namenode -format -
Start Hadoop:
start-dfs.sh start-yarn.sh -
Verify Installation:
Check if Hadoop is running:jps
This should show the Hadoop daemons running, such as NameNode, DataNode, ResourceManager, and NodeManager.
