每日总结

Hadoop运行环境搭建

模板虚拟机环境准备

0)安装模板虚拟机,IP地址192.168.10.100、主机名称hadoop100、内存4G硬盘50G

 

1hadoop100虚拟机配置要求如下(本文Linux系统全部以CentOS-7.5-x86-1804为例)

1)使用yum安装需要虚拟机可以正常上网,yum安装前可以先测试下虚拟机联网情况

[root@hadoop100 ~]# ping www.baidu.com

PING www.baidu.com (14.215.177.39) 56(84) bytes of data.

64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=128 time=8.60 ms

64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=2 ttl=128 time=7.72 ms

(2)安装epel-release

注:Extra Packages for Enterprise Linux是为“红帽系”的操作系统提供额外的软件包,适用于RHELCentOSScientific Linux。相当于是一个软件仓库,大多数rpm包在官方 repository 中是找不到的)

[root@hadoop100 ~]# yum install -y epel-release

3)注意:如果Linux安装的是最小系统版,还需要安装如下工具;如果安装的是Linux桌面标准版,不需要执行如下操作

  • net-tool:工具包集合,包含ifconfig等命令

[root@hadoop100 ~]# yum install -y net-tools

  • vim:编辑器

[root@hadoop100 ~]# yum install -y vim

2)关闭防火墙,关闭防火墙开机自启

[root@hadoop100 ~]# systemctl stop firewalld

[root@hadoop100 ~]# systemctl disable firewalld.service

注意:在企业开发时,通常单个服务器的防火墙时关闭的。公司整体对外会设置非常安全的防火墙

3)创建atguigu用户,并修改atguigu用户的密码

[root@hadoop100 ~]# useradd atguigu

[root@hadoop100 ~]# passwd atguigu

4)配置atguigu用户具有root权限,方便后期加sudo执行root权限的命令

[root@hadoop100 ~]# vim /etc/sudoers

修改/etc/sudoers文件,在%wheel这行下面添加一行,如下所示:

## Allow root to run any commands anywhere

root    ALL=(ALL)     ALL

 

## Allows people in group wheel to run all commands

%wheel  ALL=(ALL)       ALL

atguigu   ALL=(ALL)     NOPASSWD:ALL

注意:atguigu这一行不要直接放到root行下面,因为所有用户都属于wheel组,你先配置了atguigu具有免密功能,但是程序执行到%wheel行时,该功能又被覆盖回需要密码。所以atguigu要放到%wheel这行下面。

5/opt目录下创建文件夹,并修改所属主和所属组

1)在/opt目录下创建modulesoftware文件夹

[root@hadoop100 ~]# mkdir /opt/module

[root@hadoop100 ~]# mkdir /opt/software

2)修改modulesoftware文件夹的所有者和所属组均为atguigu用户 

[root@hadoop100 ~]# chown atguigu:atguigu /opt/module

[root@hadoop100 ~]# chown atguigu:atguigu /opt/software

3查看modulesoftware文件夹的所有者和所属组

[root@hadoop100 ~]# cd /opt/

[root@hadoop100 opt]# ll

总用量 12

drwxr-xr-x. 2 atguigu atguigu 4096 5月  28 17:18 module

drwxr-xr-x. 2 root    root    4096 9月   7 2017 rh

drwxr-xr-x. 2 atguigu atguigu 4096 5月  28 17:18 software

6)卸载虚拟机自带的JDK

注意:如果你的虚拟机是最小化安装不需要执行这一步。

[root@hadoop100 ~]# rpm -qa | grep -i java | xargs -n1 rpm -e --nodeps

  • rpm -qa:查询所安装的所有rpm软件包
  • grep -i:忽略大小写
  • xargs -n1:表示每次只传递一个参数
  • rpm -e –nodeps:强制卸载软件

7)重启虚拟机

[root@hadoop100 ~]# reboot

posted @ 2021-09-24 20:42  小萌新一枚lll  阅读(27)  评论(0编辑  收藏  举报