sudo nano /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
sudo yum clean all
sudo yum makecache
配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_202
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
source /etc/profile
java -version
安装hadoop
tar -zxvf hadoop-3.3.6.tar.gz
mkdir /usr/local/hadoop
mv /root/soft/hadoop-3.3.6/ /usr/local/hadoop/
cd /usr/local/hadoop/hadoop-3.3.6/
修改配置文件
vi /usr/local/hadoop/hadoop-3.3.6/etc/hadoop/core-site.xml
<property>
<name>fs.defaultFS</name>
<value>hdfs://127.0.0.1:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<!-- 自定义 hadoop 的工作目录 -->
<value>/usr/local/hadoop/hadoop-3.3.6/tmp</value>
</property>
<property>
<name>hadoop.native.lib</name>
<!-- 禁用Hadoop的本地库 -->
<value>false</value>
</property>
vi /usr/local/hadoop/hadoop-3.3.6/etc/hadoop/hdfs-site.xml
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
vi /usr/local/hadoop/hadoop-3.3.6/etc/hadoop/yarn-site.xml
<property>
<name>yarn.resourcemanager.hostname</name>
<value>127.0.0.1</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<!-- yarn web 页面 -->
<value>0.0.0.0:8088</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<!-- reducer获取数据的方式 -->
<value>mapreduce_shuffle</value>
</property>
vi /usr/local/hadoop/hadoop-3.3.6/etc/hadoop/mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANGER_USER=root
export JAVA_HOME=/usr/local/java/jdk1.8.0_202
export HADOOP_CONF_DIR=/usr/local/hadoop/hadoop-3.3.6/etc/hadoop
vi /etc/profile
export HADOOP_HOME=/usr/local/hadoop/hadoop-3.3.6
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
export HADOOP_HDFS_HOME=/usr/local/hadoop/hadoop-3.3.6
export PATH=$PATH:$HADOOP_HDFS_HOME/bin
export HADOOP_MAPRED_HOME=/usr/local/hadoop/hadoop-3.3.6
export PATH=$PATH:$HADOOP_MAPRED_HOME/bin
source /etc/profile
检查 PATH 中是否包含 $HADOOP_HOME/bin:$HADOOP_HOME/sbin 对应的目录
echo $PATH
本文转载自: https://blog.csdn.net/Zyl388636134266/article/details/142073302
版权归原作者 Zyl388636134266 所有, 如有侵权,请联系我们删除。
版权归原作者 Zyl388636134266 所有, 如有侵权,请联系我们删除。