Hadoop搭建

一、虚拟机的搭建:

  1. 关闭防火墙,CentOS 6 和CentOS 7 的关闭方式略有不同。
  • 在CentOS 6 中操作防火墙的基本命令
    service iptable status -- 查看防火墙的状态
    service iptables stop -- 关闭防火墙
    service iptables start -- 启动防火墙
    service iptables restart -- 重启防火墙
    chkconfig iptables off -- 永久关闭防火墙
    chkconfig iptables on -- 永久关闭防火墙后重新启动防火墙
  • 在CentOS 7 中操作防火墙的基本命令,在CentOS 7默认使用的是firewall作为防火墙
    firewall-cmd --state -- 查看防火墙的状态
    systemctl stop firewalld.service -- 停止firewall
    systemctl start firewalld.service -- 开启firewall
    systemctl disable firewalld.service -- 禁止开机启动firewall
  1. 创建一个一般用户
    useradd Synhard
    passwd Synhard
    19991013
  2. 在/opt目录下创建software 和 module文件夹
    mkdir /opt/software /opt/module
    chown Synhard:19991013 /opt/software /opt/module (将这两个文件夹的权限赋值给新创建的用户)
  3. 将新创建的用户加入sudoers
    vim /etc/sudoers
    Synhard ALL=(ALL) NOPASSWD:ALL
    Esc + :wq! (强制保存)
  4. 更改Host文件
    创建脚本,使用脚本向/etc/hosts文件中写入对应的IP地址和Host主机名
    vim test.sh 创建test脚本
    在test脚本中编写如下代码:
    #! /bin/bash
    for ((i=100;i<104;i++))
    do
    echo "192.168.40.$i hadoop `expr $i-100`
    done
    Esc 退出 :wq 保存
    运行test.sh文件
    bash test.sh
  5. 更改静态IP
    vim /etc/sysconfig/network-scripts/ifcfg-ens33
    TYPE=Ethernet
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=192.168.40.100
    PREFIX=24
    GATEWAY=192.168.40.2
    DNS1=192.168.40.2
    NAME=eth0
    如果是克隆的虚拟机需要还需要更改MAC地址
    更改完保存退出后执行命令
    service network restart 重启网络服务
    7.更改主机名
    vim /etc/hostname
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。