每日总结
在hadoop102安装Hadoop
Hadoop下载地址:https://archive.apache.org/dist/hadoop/common/hadoop-3.1.3/
1)用XShell文件传输工具将hadoop-3.1.3.tar.gz导入到opt目录下面的software文件夹下面
2)进入到Hadoop安装包路径下
[atguigu@hadoop102 ~]$ cd /opt/software/
3)解压安装文件到/opt/module下面
[atguigu@hadoop102 software]$ tar -zxvf hadoop-3.1.3.tar.gz -C /opt/module/
4)查看是否解压成功
[atguigu@hadoop102 software]$ ls /opt/module/
hadoop-3.1.3
5)将Hadoop添加到环境变量
(1)获取Hadoop安装路径
[atguigu@hadoop102 hadoop-3.1.3]$ pwd
/opt/module/hadoop-3.1.3
(2)打开/etc/profile.d/my_env.sh文件
[atguigu@hadoop102 hadoop-3.1.3]$ sudo vim /etc/profile.d/my_env.sh
- 在my_env.sh文件末尾添加如下内容:(shift+g)
#HADOOP_HOME
export HADOOP_HOME=/opt/module/hadoop-3.1.3
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
- 保存并退出: :wq
(3)让修改后的文件生效
[atguigu@hadoop102 hadoop-3.1.3]$ source /etc/profile
6)测试是否安装成功
[atguigu@hadoop102 hadoop-3.1.3]$ hadoop version
Hadoop 3.1.3
7)重启(如果Hadoop命令不能用再重启虚拟机)
[atguigu@hadoop102 hadoop-3.1.3]$ sudo reboot