centos7前期环境准备

开启网络

  1. cd /etc/sysconfig/network-scripts/

  2. vi ifcfg-enp0s3

/etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"         # 使用静态IP地址,默认为dhcp
IPADDR="192.168.8.119"     # 设置的静态IP地址
NETMASK="255.255.255.0"    # 子网掩码
GATEWAY="192.168.8.1"      # 网关地址
DNS1="114.114.114.114"     # DNS服务器
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="95b614cd-79b0-4755-b08d-99f1cca7271b"
DEVICE="ens33"
ONBOOT="yes"             #是否开机启用

ONBOOT=yes #开启自动启用网络连接

service network restart

环境准备

1.安装必要组件

yum -y install wget

yum -y install vim 

yum -y install initscripts

yum -y install net-tools 

出现问题:bash: netstat: command not found   

bash: service: command not found

2.添加域名解析

问题:wget: unable to resolve host address 'aliyun-oss.linuxeye.com'
vim /etc/resolv.conf

nameserver 114.114.114.114
nameserver 8.8.8.8
nameserver 8.8.4.4

然后执行

chattr +i /etc/resolv.conf

3.配置epel源

cd /etc/yum.repos.d 下载对应系统版本的repo文件

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

   centos6:

   #替换为官方Vault源
   wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo

   #替换为阿里云Vault镜像
   wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo

yum clean all 清理缓存

yum makecache 生成新的缓存


在root用户下执行下面命令:

rpm -ivh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum repolist

4.安装常用工具

yum install wget vim gcc zip unzip -y

5.配置最大文件打开数
在root用户下执行下面命令:

echo ulimit -n 65536 >> /etc/profile 
source /etc/profile    
ulimit -n    
vim /etc/security/limits.conf

在文件尾部添加如下代码:

* soft nofile 65536
* hard nofile 65536

重启系统,在任何用户下查看最大打开文件数:ulimit -n 结果都是65536
6.更新系统

yum update

1先解决最小化ip问题

centOS7.6最小化安装后生成ip - 简书

2设置机器名

vi /etc/sysconfig/network

# Created by anaconda
NETWORKING=yes
HOSTNAME=hadoop01

3设置Host文件

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.91.128 hadoop01

4关闭防火墙(所有节点)

检查防火墙的状态:
从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig。

[root@localhost ~]#systemctl list-unit-files|grep firewalld.service

--防火墙处于关闭状态
firewalld.service disabled
关闭防火墙:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

关闭SElinux(所有节点) :
1.使用getenforce命令查看是否关闭
如果屏幕输出Enforcing,则表示SElinux为开启状态。
2.修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled,执行该命令后重启机器生效

配置NTP服务(所有节点)

如果您正在使用NTPD 同步你的主机时钟,但是 chronyd 也正在运行,Cloudera Manager依赖 chronyd验证时间同步,即使它没有正确同步。这可能导致Cloudera Manager报告 时钟偏移错误,即使时间正确。
要解决此问题,请配置和使用 chronyd 或禁用它并从主机中删除它。

systemctl disable chronyd 彻底禁用chrony服务
systemctl stop chronyd 停止chrony服务

使用 NTPD 时间同步:
Install the ntp package:

yum install ntp -y

Edit the /etc/ntp.conf file to add NTP servers, as in the following example.

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

Start the ntpd service:

sudo systemctl start ntpd

Configure the ntpd service to run at boot:

sudo systemctl enable ntpd

Synchronize the system clock to the NTP server:

ntpdate -u 0.pool.ntp.org

Synchronize the hardware clock to the system clock:

hwclock --systohc

5安装JDK1.8

centOS安装JDK - 简书

6安装MySQL

centOS7.6安装MySQL - 简书

7克隆出新节点,并且ssh免密发送秘钥

设置SSH无密码登录

Hadoop集群中的各个机器间会相互地通过SSH访问,每次访问都输入密码是不现实的,所以要配置各个机器间的SSH是无密码登录的。

1、 在hadoop01上生成公钥

[root@hadoop01 ~]# ssh-keygen -t rsa

一路回车,都设置为默认值,然后再当前用户的Home目录下的.ssh目录中会生成公钥文件(id_rsa.pub)和私钥文件(id_rsa)。

2、 分发公钥

yum -y install openssh-server openssh-clients
[root@hadoop01 ~] ssh-copy-id hadoop01
[root@hadoop01 ~] ssh-copy-id hadoop02
[root@hadoop01 ~] ssh-copy-id hadoop03

3、 设置hadoop02、hadoop03到其他机器的无密钥登录

同样的在hadoop02、hadoop03上生成公钥和私钥后,将公钥分发到三台机器上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值