Hadoop之虚拟机准备

1、虚拟机环境准备

方式1:新建虚拟机:

1. 创建虚拟机

https://blog.csdn.net/weixin_43671437/article/details/105936977

2. 关闭防火墙

systemctl stop iptables.service
 查看是否关闭
systemctl status iptables.service

关闭成功(dead)

● iptables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

3. 配置虚拟机的静态IP

https://blog.csdn.net/weixin_43671437/article/details/102690205

4. 创建atguigu用户

添加用户

useradd atguigu

为用户设置密码

passwd atguigu

5. 配置atguigu用户具有root权限

https://blog.csdn.net/weixin_43671437/article/details/105936677

6. 修改主机名

https://blog.csdn.net/weixin_43671437/article/details/102995235

7. 在/opt目录下创建文件夹

mkidr /opt/software /opt/module
chown -R  atguigu:atguigu /opt

方式2:克隆虚拟机

克隆一台新的虚拟机(空虚拟机),什么都没有配置

1、克隆虚拟机

第一步:

在这里插入图片描述

第二步:

在这里插入图片描述

第三步:

在这里插入图片描述

第四步:

在这里插入图片描述

第五步:

在这里插入图片描述

2、关闭防火墙

查看防火墙状态

systemctl status firewalld

关闭防火墙

systemctl stop firewalld

禁止开机自启

systemctl disable firewalld

查看防火墙状态

systemctl status firewalld

3、创建atguigu用户

useradd atguigu
passwd atguigu

附加:删除用户(-r,同时删除/home中的文件夹)

userdel -r atguigu

4、在/opt目录下创建module,software两个文件夹,并修改所属用户和所属组修改为atguigu

mkdir /opt/module /opt/software
chown atguigu:atguigu /opt/module /opt/software

扩展:mkdir -p 创建多层文件夹

​ chwon -r 同时将文件夹中的文件的所属用户与所属组改变

5、配置atguigu用户具有root权限

进入sudoers文件

vim /etc/sudoers

在root下添加:

## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
atguigu ALL=(ALL)       NOPASSWD:ALL

wq!强制保存退出

以下步骤每次克隆虚拟机都要操作一遍(6、7、8)

6、修改克隆虚拟机的静态IP

进入文件

vim /etc/sysconfig/network-scripts/ifcfg-eno16777736

修改配置文件(比这个文件多的全删掉)

DEVICE=eno16777736
NAME=eno16777736
TYPE=Ethernet
PREFIX=24
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.100
GATEWAY=192.168.1.2
DNS1=144.144.144.144
DNS2=8.8.8.8

重启网络服务

systemctl restart network

查看ip

ifconfig

7、修改主机名

  • 修改主机名
hostnamectl set-hostname 'hadoop101'
  • 修改/etc/sysconfig/network
vim /etc/sysconfig/network

添加如下内容:

NETWORKING=yes
HOSTNAME=hadoop101
  • 修改/etc/hosts(配置主机映射)
vim /etc/hosts

添加内容如下ip+hostname

192.168.1.100    hadoop100
192.168.1.101    hadoop101
192.168.1.102    hadoop102
192.168.1.103    hadoop103
192.168.1.104    hadoop104
192.168.1.105    hadoop105
192.168.1.106    hadoop106
192.168.1.107    hadoop107
192.168.1.108    hadoop108
192.168.1.109    hadoop109

或者编写一个脚本自动添加

vim test.sh

脚本内容

#!/bin/bash
for((i=100;i<110;i++))
do
        echo "192.168.1.$i    hadoop$i" >> /etc/hosts
done

运行脚本

bash test.sh

8、修改网卡

vim /etc/udev/rules.d/70-persistent-ipoib.rules

centos7貌似不用修改这一步

在这里插入图片描述

修改后:

Over!!

原创文章 76 获赞 97 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43671437/article/details/106000277