上官网下载合适的安装包 http://hadoop.apache.org/
1 把安装包放到合适的目录下,安装到 /usr/local
1、在安装包所在的文件夹,右击打开控制台
2、解压安装包到指定的位置
tar -zxvf hadoop-2.9.2.tar.gz -C /usr/local
2 运行MapReduce程序来验证安装是否成功
1、用hadoop自带的wordcount例子来在本地模式下测试跑mapreduce
在安装目录下新建一个input文件夹,从本地系统传送个txt文件到该文件夹。
文件内容:to be or not to be ,that is a question!
2、在控制台中输入如下命令,input为输入路径,output为输出路径(统计input目录下所有文件的单词出现的次数)
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar wordcount input output
运行成功的话,会自动生成一个output的文件夹,里面包含如下文件(出现SUCCESS文件说明安装成功)