Hadoop运行环境搭建
1.准备一台虚拟机(最小化安装作为模板机)
修改主机名(hadoop101)
[root@localhost ~]# vi /etc/hostname
固定IP地址(192.168.2.101)
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=“static”
IPADDR=192.168.2.101
GATEWAY=192.168.2.2
DNS1=192.168.2.2
使用xshell工具连接虚拟机
模板虚拟机hadoop101内安装基础软件
[root@hadoop101 ~]# yum install -y epel-release
[root@hadoop101 ~]# yum install -y psmisc nc net-tools rsync vim lrzsz ntp libzstd openssl-static tree iotop git
关闭防火墙
[root@hadoop101 ~]# systemctl stop firewalld
[root@hadoop101 ~]# systemctl disable firewalld
修改hosts文件
[root@hadoop101 ~]# vim /etc/hosts
192.168.2.101 hadoop101
创建普通用户并提升为root权限
[root@hadoop101 ~]# useradd ’用户名‘
[root@hadoop101 ~]# passwd ’密码‘
修改sudoers文件
[root@hadoop101 ~]# vim /etc/sudoers
root ALL=(ALL) ALL
‘用户名’ ALL=(ALL) NOPASSWD:ALL
在Linux的/opt目录下创建software和module文件夹
[root@hadoop101 ~]# cd /opt
[root@hadoop101 opt]# mkdir software
[root@hadoop101 opt]# mkdir module
将software和module目录下的所有者和所属组修改为’用户名‘
[root@hadoop101 opt]# chown 用户名:密码 module
[root@hadoop101 opt]# chown 用户名:密码 software
2.通过克隆模板机hadoop101的方式创建hadoop102
更改IP地址
[root@hadoop101 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.2.102 #将这里的101改为102
更改主机名
[root@hadoop101 ~]# vim /etc/hostname
hadoop101 改为hadoop102
重启 reboot
3.在hadoop102内安装JDK和hadoop
[root@hadoop102 ~]# cd /opt/software/
用Xftp5将JDK导入到opt目录下的software文件夹下
安装解压到module文件夹下
[root@hadoop102 software]# tar -zxvf jdk-8u212-linux-x64.tar.gz -C …/module/
配置JDK的环境变量,到profile.d文件夹下自定义配置脚本
[root@hadoop102 software]# cd /etc/profile.d<