首先修改host,将需要互相免密的机器相互加入到host文件中:
vi /etc/hostname #添加主机名 hadoop2 vi /etc/sysconfig/network #添加IP和hostname对应关系 192.168.8.107 hadoop2
重启reboot生效
-
查询本机是否有安装ssh包
rpm -qa|grep ssh
如果没有则安装ssh
yum -y install sshd #(yum install openssh-server) 安装ssh服务
-
修改ssh配置文件(启用22端口)
vi /etc/ssh/sshd_config #重启ssh服务 systemctl restart sshd
-
开放防火墙22端口为公开
firewall-cmd --zone=public --add-port=22/tcp --permanent 重启防火墙 systemctl restart firewalld.service 重新载入配置 firewall-cmd --reload 查看 public 区域下所有已打开的端口 firewall-