[atguigu@hadoop101 ~]$ cd /opt/software/
[atguigu@hadoop101 software]$ tar -zxvf hadoop-2.7.2.tar.gz -C /opt/module/
[atguigu@hadoop101 software]$ ls /opt/module/
hadoop-2.7.2
5. 将Hadoop添加到环境变量
(1)获取Hadoop安装路径
[atguigu@hadoop101 hadoop-2.7.2]$ pwd
/opt/module/hadoop-2.7.2
(2)打开/etc/profile文件
[atguigu@hadoop101 hadoop-2.7.2]$ sudo vi /etc/profile
在profile文件末尾添加JDK路径:(shitf+g)
##HADOOP_HOME
export HADOOP_HOME=/opt/module/hadoop-2.7.2
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
(3)保存后退出
:wq
(4)让修改后的文件生效
[atguigu@ hadoop101 hadoop-2.7.2]$ source /etc/profile
6. 测试是否安装成功
[atguigu@hadoop101 hadoop-2.7.2]$ hadoop version
Hadoop 2.7.2
7. 重启(如果Hadoop命令不能用再重启)
[atguigu@ hadoop101 hadoop-2.7.2]$ sync
[atguigu@ hadoop101 hadoop-2.7.2]$ sudo reboot
手机扫一扫
移动阅读更方便
你可能感兴趣的文章