Centos7 安装 CDH 6.2 (一):机器准备

    xiaoxiao2024-11-30  64

    文章目录

    1. 机器规划2. 修改hostname3. 关闭防火墙4. 安装 ELRepo、 EPEL 仓库5. 更新并安装常用依赖6. 修改虚拟内存交换页大小7. 设置固定IP8. 设置免密登录9. 设置hosts10. kernel优化11. 关闭 selinux12.同步时间13. 安装Python 2.7 、jdk1.8

    1. 机器规划

    系统为Centos7.6,本教程机器规划如下(酌情修改):

    hostnameIPCDH角色c7-1.com10.0.0.101Cloudera Managec7-2.com10.0.0.102Cloudera Agentc7-3.com10.0.0.103Cloudera Agent

    2. 修改hostname

    # c7-1.com 执行 hostnamectl set-hostname c7-1.com echo "HOSTNAME=c7-1.com" > /etc/sysconfig/network # c7-2.com 执行 hostnamectl set-hostname c7-2.com echo "HOSTNAME=c7-2.com" > /etc/sysconfig/network # c7-3.com 执行 hostnamectl set-hostname c7-3.com echo "HOSTNAME=c7-3.com" > /etc/sysconfig/network

    3. 关闭防火墙

    # c7-[1-3].com 执行 ### 禁止防火墙自启 systemctl disable firewalld ### 关闭防火墙 systemctl stop firewalld

    4. 安装 ELRepo、 EPEL 仓库

    # c7-[1-3].com 执行 ### 安装EPEL仓库 yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y ### 安装ELREPO仓库密钥 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ### 安装ELREPO仓库 yum install https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm -y

    5. 更新并安装常用依赖

    # c7-[1-3].com 执行 yum update -y yum install vim wget net-tools git unzip zip gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y

    6. 修改虚拟内存交换页大小

    # c7-[1-3].com 执行 # 临时修改 sysctl -w vm.swappiness=0 # 永久修改 echo "vm.swappiness=0" > /etc/sysctl.conf

    7. 设置固定IP

    # c7-1.com 执行 vim /etc/sysconfig/network-scripts/ifcfg-eth0 # 修改或添加以下内容 # 将dhcp设置为static BOOTPROTO=static #名称 DEVICE=eth0 # 开机启动 ONBOOT=yes IPADDR=10.0.0.101 # 这个需要和你前面设置的IP网段一样 # 网关 GATEWAY=10.0.0.1 #子网掩码 NETMASK=255.0.0.0 # 重启网络 systemctl restart network # c7-2.com 执行 vim /etc/sysconfig/network-scripts/ifcfg-eth0 # 修改或添加以下内容 # 将dhcp设置为static BOOTPROTO=static #名称 DEVICE=eth0 # 开机启动 ONBOOT=yes IPADDR=10.0.0.102 # 这个需要和你前面设置的IP网段一样 # 网关 GATEWAY=10.0.0.1 #子网掩码 NETMASK=255.0.0.0 # 重启网络 systemctl restart network # 设置DNS vim /etc/resolv.conf # search mshome.net 下添加 nameserver 114.114.114.114 # c7-3.com 执行 vim /etc/sysconfig/network-scripts/ifcfg-eth0 # 修改或添加以下内容 # 将dhcp设置为static BOOTPROTO=static #名称 DEVICE=eth0 # 开机启动 ONBOOT=yes IPADDR=10.0.0.103 # 这个需要和你前面设置的IP网段一样 # 网关 GATEWAY=10.0.0.1 # 第一个DNS DNS1=223.5.5.5 #子网掩码 NETMASK=255.0.0.0 # 重启网络 systemctl restart network

    8. 设置免密登录

    # c7-1.com 执行 # 生成密钥 ssh-keygen -t rsa -f ~/.ssh/id_rsa # 拷贝至 c7-[2-3].com ssh-copy-id c7-2.com ssh-copy-id c7-3.com

    9. 设置hosts

    # c7-1.com 执行 vim /etc/hosts # 添加以下内容 10.0.0.101 c7-1.com 10.0.0.102 c7-2.com 10.0.0.103 c7-3.com # 分发hosts至c7-[2-3].com scp /etc/hosts c7-2.com:/etc/hosts scp /etc/hosts c7-3.com:/etc/hosts

    10. kernel优化

    # c7-[1-3].com 执行 echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled # 添加开机自启 echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local # 赋予权限 chmod u+x /etc/rc.local

    11. 关闭 selinux

    # c7-[1-3].com 执行 # 永久修改 sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config # 刷新,立即生效 setenforce 0

    12.同步时间

    # c7-[1-3].com 执行 yum install ntp -y # 立即同步时间 ntpdate ntp1.aliyun.com # 设置同步时间池 sed -i 's/server 0.centos.pool.ntp.org iburst/server ntp1.aliyun.com/g' /etc/ntp.conf sed -i 's/server 1.centos.pool.ntp.org iburst/server ntp2.aliyun.com/g' /etc/ntp.conf sed -i 's/server 2.centos.pool.ntp.org iburst/server ntp3.aliyun.com/g' /etc/ntp.conf sed -i 's/server 3.centos.pool.ntp.org iburst/server ntp4.aliyun.com/g' /etc/ntp.conf # 开机自启 systemctl enable ntpd # 启动ntp服务 systemctl start ntpd

    13. 安装Python 2.7 、jdk1.8

    # c7-[1-3].com yum install python27 java-1.8.0-openjdk-devel -y
    最新回复(0)