Hadoop集群搭建--Linux服务器配置
1. 配置IP及主机名映射
设置IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=722edcfd-8fa3-4090-a68a-51e498049e53
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
HWADDR=00:0C:29:4C:45:22
IPADDR=192.168.112.50
PREFIX=24
GATEWAY=192.168.112.2
DNS1=192.168.112.2
设置主机名
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=bd-server.rabbit.com
设置IP和主机名的映射关系
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.112.50 bd-server.rabbit.com
2.关闭防火墙及SELinux
service iptables stop
chkconfig iptables off
vi /etc/selinux/config
设置SELINUX=disabled
3.设置时间同步
yum install ntp -y
vi /etc/ntp.conf
server ntp1.aliyun.com
service ntpd start
chkconfig ntpd on
4.安装JDK(版本需要8及以上)
rpm -ivh jdk-8XXXXXX.rpm
配置JAVAHOME和PATH
vi /etc/profile
export JAVA_HOME=/opt/moudles/jdk1.8.0_151
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
5.设置免密登录
(如果A想免密登录B,需要将自己的公钥分发到B)
验证自己是否免密:
ssh localhost (此时会自动生成 .ssh目录)
生成公私钥:
ssh-keygen -t dsa -P '' -f /root/.ssh/id_dsa
cat /root/.ssh/id_dsa.pub >> /root/.ssh/authorized_keys
再执行 ssh localhost 就不会提示输入密码了