实验1 Hadoop伪分布式安装
- 下载安装虚拟机软件Vmware,下载Ubuntu镜像文件,安装Ubuntu虚拟机

- 在Ubuntu系统中创建用户
已有用户prx17

更新APT ,安装vim

使用vim创建并编辑一个文件
vim hello.c
(按o键进入编辑模式)
源程序
#include<stdio.h>
void main(){
printf("hello world!\n");
}

点击esc退出编辑模式,输入:wq,保存并退出文件
Ls查看文件

安装SSH并配置SSH无密码登录

使用ssh localhost登录

配置无密码登录

完成无密码登录

安装Java环境
解压缩

配置环境

检查是否安装成功

- 下载Hadoop并解压
解压缩hadoop安装包,给予用户prx17 hadoop文件权限,并检查hadoop是否安装成功

选择运行grep例子

- Hadoop伪分布式安装(修改配置文件;
core-site.xml

hdfs-site.xml

名称节点格式化;
./bin/hdfs namenode -format
"successfully formatted"的提示信息

启动Hadoop,输入jps命令,查看是否启动成功
启动成功,也可以使用start-all.sh,但是伪分布式可以只使用dfs

Web http://localhost:9870查看hdfs信息

l

- 运行测试例子
创建用户目录

运行自带的grep程序

- 关闭Hadoop
./sbin/stop-dfs.s

心得体会:
在安装hadoop之后发生了查看hadoop version失败的问题,后来发现是安装路径添加错误。