# 1.首先安装一台centos7(4G+40G+NAT+最小安装+管理员密码设置为root),并复制三份,分别重命名为node01,node02,node03.
# 2。其次分别对 node01,node02,node03 三台主机进行如下配置
# 将网卡配置文件最后一行的 ONBOOT=no 修改为 ONBOOT=yes
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT=yes
[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]
[root@localhost ~]# yum -y install net-tools wget vim zip unzip lrzsz
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.150.128 netmask 255.255.255.0 broadcast 192.168.150.255
inet6 fe80::6841:a8ff:9497:3fed prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:27:93:c9 txqueuelen 1000 (Ethernet)
RX packets 10025 bytes 13728909 (13.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3181 bytes 201222 (196.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 388 bytes 33760 (32.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 388 bytes 33760 (32.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# 3.根据ifcfg查出的网卡ens-33的IP地址信息分别配置三个XShell连接三台主机(node01,node02,node03)
# 此处为 node01:192.168.150.128;node02:192.168.150.129;node03:192.168.150.130;
| IP | 主机名 | 环境配置 | 安装 |
| --------------- | ------ | ------------------------------------- | ----------------------------------------- |
| 192.168.150.128 | node01 | 关防火墙和selinux, host映射, 时钟同步 | JDK, NameNode, ResourceManager, Zookeeper |
| 192.168.150.129 | node02 | 关防火墙和selinux, host映射, 时钟同步 | JDK, DataNode, NodeManager, Zeekeeper |
| 192.168.150.130 | node03 | 关防火墙和selinux, host映射, 时钟同步 | JDK, DataNode, NodeManager, Zeekeeper |
#######################################################################################
# 3.1 对 node01 进行如下配置:
# 设置静态IP地址和域名解析服务器
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
# BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
# IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=1025d48f-6f0f-4af9-b96f-bc0f2576b551
DEVICE=ens33
# ONBOOT=no
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.150.128
NETMASK=255.255.255.0
GATEWAY=192.168.150.2
DNS1=114.114.114.114
ZONE=public
[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]
# 修改主机名
[root@localhost ~]# vim /etc/hostname
node01.localdomain
#设置域名映射
[root@node01~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.150.128 node01.hadoop.com node01
192.168.150.129 node02.hadoop.com node02
192.168.150.130 node03.hadoop.com node03
# 关闭并禁用防火墙
[root@node01 ~]# systemctl stop firewalld.service
[root@node01 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 修改并禁用selinux
[root@node01 ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
# 配置远程服务器的无密钥远程登录
[root@node01 ~]# cd ~
[root@node01 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
[root@node01 ~]#
####################################################################################
# 3.2 对 node02 进行如下配置:
# 设置静态IP地址和域名解析服务器
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
# BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
# IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=1025d48f-6f0f-4af9-b96f-bc0f2576b552
DEVICE=ens33
# ONBOOT=no
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.150.129
NETMASK=255.255.255.0
GATEWAY=192.168.150.2
DNS1=114.114.114.114
ZONE=public
[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]
# 修改主机名
[root@localhost ~]# vim /etc/hostname
node02.localdomain
#设置域名映射
[root@node02~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.150.128 node01.hadoop.com node01
192.168.150.129 node02.hadoop.com node02
192.168.150.130 node03.hadoop.com node03
# 关闭并禁用防火墙
[root@node02 ~]# systemctl stop firewalld.service
[root@node02 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 修改并禁用selinux
[root@node02 ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
# 配置远程服务器的无密钥远程登录
[root@node02 ~]# cd ~
[root@node02 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
[root@node02 ~]#
####################################################################################
# 3.3 对 node03 进行如下配置:
# 设置静态IP地址和域名解析服务器
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
# BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
# IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=1025d48f-6f0f-4af9-b96f-bc0f2576b553
DEVICE=ens33
# ONBOOT=no
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.150.130
NETMASK=255.255.255.0
GATEWAY=192.168.150.2
DNS1=114.114.114.114
ZONE=public
[root@localhost ~]# service network restart
Restarting network (via systemctl): [ OK ]
# 修改主机名
[root@localhost ~]# vim /etc/hostname
node03.localdomain
#设置域名映射
[root@node03 ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.150.128 node01.hadoop.com node01
192.168.150.129 node02.hadoop.com node02
192.168.150.130 node03.hadoop.com node03
# 关闭并禁用防火墙
[root@node03 ~]# systemctl stop firewalld.service
[root@node03 ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
# 修改并禁用selinux
[root@node03 ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
# 配置远程服务器的无密钥远程登录
[root@node03 ~]# cd ~
[root@node03 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
[root@node03 ~]#
来源:CSDN
作者:脚踏实地的理想主义者
链接:https://blog.csdn.net/qq_38179971/article/details/104058313