Linux

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > Linux > Linux免密登录单机和全分布

Linux配置免密登录单机和全分布详细教程

作者:一个人的牛牛

大家好,本篇文章主要讲的是Linux配置免密登录单机和全分布详细教程,感兴趣的同学赶快来看一看吧,对你有帮助的话记得收藏一下哦

一:单机免密登录配置

1.设置虚拟机主机名

hostnamectl --static set-hostname hadoop001

--static 参数代表永久生效 hadoop001为虚拟机主机名;

2.虚拟机中配置主机名与ip地址的映射关系

vi /etc/hosts

在文件的末尾添加    (IP地址可以用命令ip addr查看)

192.168.17.131 hadoop001

3.关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

4.执行如下命令:

 ssh-keygen -t rsa (执行命令后,只需敲三次回车键)
 cd ~/.ssh/
 ssh-copy-id -i id_rsa.pub root@hadoop001

 成功!!!

二:全分布免密登录配置

 1.设置每台虚拟机的主机名

hostnamectl --static set-hostname hadoop001 (主节点)
hostnamectl --static set-hostname hadoop002  (从节点1)
hostnamectl --static set-hostname hadoop003  (从节点2)

--static 参数代表永久生效 hadoop001为虚拟机主机名;

2.虚拟机中配置主机名与ip地址的映射关系(每一台都要操作)

vi /etc/hosts

在文件的末尾添加    (IP地址可以用命令ip addr查看)

192.168.17.131 hadoop001
192.168.17.132 hadoop002
192.168.17.133 hadoop004

3.关闭防火墙(每一台都要操作)

systemctl stop firewalld.service
systemctl disable firewalld.service

4.执行如下命令:

ssh-keygen -t rsa (执行命令后,只需敲三次回车键)
cd ~/.ssh/
ssh-copy-id -i id_rsa.pub root@hadoop001
ssh-copy-id -i id_rsa.pub root@hadoop002
ssh-copy-id -i id_rsa.pub root@hadoop003

 

成功!!!

到此这篇关于Linux配置免密登录单机和全分布详细教程的文章就介绍到这了,更多相关Linux免密登录单机和全分布内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文