Hadoop(一) centos7 jdk安装,hadoop安装|3
安装JDK
下载jdk
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
选择最新版本:
![](https://upload-images.jianshu.io/upload_images/18296616-35dd707b05e27612.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
下载hadoop
官网:https://hadoop.apache.org/releases.html
当前时间最新版本:https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.1.2/hadoop-3.1.2.tar.gz
下载好后把我们本地的文件拽过去:
![](https://upload-images.jianshu.io/upload_images/18296616-3756a2d108a81699.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
查看jar是否上传成功:
![](https://upload-images.jianshu.io/upload_images/18296616-645accac717f4635.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装jdk
[shaozhiqi@hadoop101 software]$ tar -zxvfjdk-8u211-linux-x64.tar.gz -C /opt/module/ //-C解压到指定目录
配置环境变量:得用root权限,用sudo 就不用切换账号了
[shaozhiqi@hadoop101 module]$ sudo vim/etc/profile
[sudo] password for shaozhiqi:
Shift+G调到末尾
O跳到下一行开始编辑
![](https://upload-images.jianshu.io/upload_images/18296616-66b94ed8d4873f21.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/18296616-556f345e1e84ba87.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
用source命令在当前环境下执行配置文件,使配置文件立即生效
[shaozhiqi@hadoop101 module]$ source /etc/profile
验证发现还是centos默认的openJDK
![](https://upload-images.jianshu.io/upload_images/18296616-e7199078a02d1a82.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
卸载openJDK
执行rpm -qa | grep java命令,查看系统自带的openJdk相关的文件进行删除
![](https://upload-images.jianshu.io/upload_images/18296616-e73e002373230ecc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
[root@hadoop101 module]# rpm -e --nodepsjava-1.8.0-openjdk-headless-1.8.0.131-2.b11.el7_3.x86_64
[root@hadoop101 module]# rpm -e --nodepsjava-1.8.0-openjdk-1.8.0.131-2.b11.el7_3.x86_64
[root@hadoop101 module]# rpm -e --nodepsjava-1.7.0-openjdk-headless-1.7.0.131-2.6.9.0.el7_3.x86_64
[root@hadoop101 module]# rpm -e --nodepsjava-1.7.0-openjdk-1.7.0.131-2.6.9.0.el7_3.x86_64
安装hadoop
不要用root
[shaozhiqi@hadoop101 module]# tar -zxvfhadoop-3.1.2.tar.gz -C /opt/module/
配置hadoop环境变量
[shaozhiqi@hadoop101 module]$ sudo vim/etc/profile
![](https://upload-images.jianshu.io/upload_images/18296616-3d5ca03cda4019b6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
[shaozhiqi@hadoop101 module]$ source /etc/profile
查看hadoop是否安装成功
[shaozhiqi@hadoop101 module]$ hadoop version
![](https://upload-images.jianshu.io/upload_images/18296616-2f1839873a79dc44.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Hadoop的目录结构简要说明
bin:里面主要是命令
![](https://upload-images.jianshu.io/upload_images/18296616-86bf9c325e784fcb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
etc:存放的是hadoop的配置文件
![](https://upload-images.jianshu.io/upload_images/18296616-06093a2363b45375.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
lib:存放是一些本地库
![](https://upload-images.jianshu.io/upload_images/18296616-dba99cd3dc613456.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Sbin存放的也是命令,和集群启动相关
![](https://upload-images.jianshu.io/upload_images/18296616-494b792496fc1f9d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Share:是hadoop相关的jar
Expamples是一些案例
![](https://upload-images.jianshu.io/upload_images/18296616-e71b6261d4a6f0ba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)