IP地址设置

  • 修改Ip地址

vi /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"  # 设置为静态ip static
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
NAME="ens33"  # 网卡的名称
DEVICE="ens33" # 设备的名称
ONBOOT="yes"  # 设置为yes, 表示开机启动
IPADDR="192.168.46.150"  # ip地址
PREFIX="24"  # 子网掩码
GATEWAY="192.168.46.2" # 网关
DNS1="114.114.115.115"  # DNS
  • 重启网络服务

systemctl restart network

  • 测试网络

ping www.baidu.com

如果可以ping通公网: 说明 ip地址和网关都配置正确

如果通过 ip addr 不能查看到ip地址, 说明配置有错误

如果可以ping通内网 192.168.46.1 但是不能ping通外网的话, 则说明网关配置有错误

设置主机名

  • 编辑主机名配置文件

vi /etc/hostname

hadoop01

设置域名映射解析

  • 编辑hosts文件

vi /etc/hosts

192.168.46.145 hadoop01 hadoop01
192.168.46.146 hadoop02 hadoop02
192.168.46.147 hadoop03 hadoop03
192.168.46.148 biz01 biz01

关闭防火墙和Selinux

  • 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
  • 关闭Selinux
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=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

配置免密登录

  1. 在所有节点生成公钥和私钥

ssh-keygen -t rsa

后面直接所有的交互都敲回车 即可

  1. 拷贝公钥到每台服务器

ssh-copy-id hadoop01

ssh-copy-id hadoop02

ssh-copy-id hadoop03

  1. 验证ssh登录

ssh hadoop01

exit # 退出ssh登录

配置服务器节点时钟同步

  1. 在所有节点安装ntpdate

yum install -y ntpdate

  1. 增加定时任务

crontab -e

*/1 * * * * /usr/sbin/ntpdate -u ntp4.aliyun.com > /dev/null 2>&1

安装常用软件

yum install -y vim
yum install -y net-tools
yum install -y lrzsz
yum install -y rsync
yum install -y wget