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免密登录单机和全分布内容请搜索0133技术站以前的文章或继续浏览下面的相关文章希望大家以后多多支持0133技术站!

以上就是Linux配置免密登录单机和全分布详细教程的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 服务器