要在CentOS 7上安装Hadoop,可以按照以下步骤进行操作:
安装Java Development Kit(JDK):
sudo yum install java-1.8.0-openjdk-devel
创建Hadoop用户:
sudo adduser hadoop
sudo passwd hadoop
下载和解压缩Hadoop:
/opt
目录下创建一个新目录:sudo mkdir /opt/hadoop
cd /opt/hadoop
sudo wget https://downloads.apache.org/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz
sudo tar -xzvf hadoop-3.3.1.tar.gz
hadoop
:sudo mv hadoop-3.3.1 hadoop
配置环境变量:
/etc/profile
文件:sudo vi /etc/profile
export HADOOP_HOME=/opt/hadoop/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
source /etc/profile
配置Hadoop:
cd /opt/hadoop/hadoop/etc/hadoop
hadoop-env.sh
文件:sudo vi hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
配置Hadoop的核心文件:
core-site.xml
文件:sudo vi core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
配置Hadoop的HDFS文件系统:
hdfs-site.xml
文件:sudo vi hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
配置Hadoop的YARN资源管理器:
yarn-site.xml
文件:sudo vi yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
配置Hadoop的MapReduce框架:
mapred-site.xml
文件:sudo vi mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
设置Hadoop的数据目录权限:
sudo mkdir -p /opt/hadoop/data/hdfs/namenode
sudo mkdir -p /opt/hadoop/data/hdfs/datanode
sudo chown -R hadoop:hadoop /opt/h
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: hadoop安装jdk的步骤是什么