提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
文章目录
前言
`
搭建Linux环境为hadoop学习奠定基础。
一、linux初步学习
为接下来hadoop的学习及环境搭建奠定基础。
二、环境搭建
1.修改静态ip
[root@haney haney]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
修改:
BOOTPROTO=“static” #修改为静态
IPADDR=192.168.58.142 #ip
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.58.2 #网关
[root@haney haney]# systemctl restart network.service ###重启网络
[root@haney haney]# ifconfig ###查看网络配置
2.修改主机名
[root@haney haney]# vim /etc/hostname ###修改主机名
[root@haney haney]# hostname ###查看主机名
haney
3.配置IP和hostname的映射关系
[root@haney haney]# vim /etc/hosts
5.设置window的host文件
修改: C:\Windows\System32\drivers\etc文件夹下的host文件(必须以管理员的身份修改)
192.168.58.142 haney
cmd测试: ping haney
三、关闭防火墙
[root@haney haney]# systemctl stop firewalld.service ###临时关闭防火墙
[root@haney haney]# firewall-cmd --state ###查看防火墙状态
四、两台机器SSH免密登录
①生成密钥
[root@haney haney]# ssh-keygen -t rsa
②将密钥copy给自己
③将密钥给其他机器
[root@haney haney]# ssh-copy-id haney4
如若发送给其他机器 /etc/hosts 下要有映射关系,否则就输其 IP