(这篇博客实属记录本人在安装以及配置环境中的一些小心得,希望能够帮助到大家。)
1.首先安装Java_JDK
在jdk版本选择上,我们一般选择JDK1.8版本,有较好的兼容性。
(附链接:链接:https://pan.baidu.com/s/11Y_dum09skPRspHNjhaBwA
提取码:3loc)
上传到Linux下进行解压,命令为
tar -zxvf 文件地址 -C 目标解压地址
例如:
tar -zxvf /home/demo/jdk-8u221-linux-x64.tar.gz -C /home/demo/hadoopApp/
解压完成后进行添加环境变量
`vi /etc/profile`
在vim编辑器中,需要输入i才能进行代码的插入,输入i后,在文件中添加自己的JDK路径,例如:
export JAVA_HOME = /home/demo/hadoopApp/jdk1.8.0_221
export PATH = $PATH:$JAVA_HOME/bin:
添加完成后,按ESC,:wq进行保存文件内容
配置完成后,需要令配置文件生效
source /etc/profile
验证是否配置成功,
java -version
若出现
即为JDK配置成功。
2.安装Hadoop
Hadoop下载路径:https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/,这里之所以用清华源作为链接地址是因为这里有Hadoop2.0的版本,而官网上都是最新的版本,并且清华源下载速度较快。
下载完成后,进行解压,与JDK相同
tar -zxvf /home/demo/hadoop-3.1.2.tar.gz -C /home/demo/hadoopApp/
解压后需要更改个别配置文件,需要修改的配置文件均在hadoop目录下/etc/hadoop/文件夹中
第一个:hadoop-env.sh,这个文件主要配置jdk环境
切换到指定的目录中,执行
vi hadoop-env.sh
添加如下代码(具体jdk安装位置依靠自己的为主):</