天天看點

centOS7.6前期環境準備1先解決最小化ip問題2設定機器名3設定Host檔案4關閉防火牆(所有節點)配置NTP服務(所有節點)5安裝JDK1.86安裝MySQL7克隆出新節點,并且ssh免密發送秘鑰

環境準備

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問題

https://www.jianshu.com/p/2d54949165a9

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。

[[email protected] ~]#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

https://www.jianshu.com/p/456041b488c9

6安裝MySQL

https://www.jianshu.com/p/1c41ce3e9305

7克隆出新節點,并且ssh免密發送秘鑰

設定SSH無密碼登入

Hadoop叢集中的各個機器間會互相地通過SSH通路,每次通路都輸入密碼是不現實的,是以要配置各個機器間的SSH是無密碼登入的。

1、 在hadoop01上生成公鑰

[[email protected] ~]# ssh-keygen -t rsa
           

一路回車,都設定為預設值,然後再目前使用者的Home目錄下的.ssh目錄中會生成公鑰檔案(id_rsa.pub)和私鑰檔案(id_rsa)。

2、 分發公鑰

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

3、 設定hadoop02、hadoop03到其他機器的無密鑰登入

同樣的在hadoop02、hadoop03上生成公鑰和私鑰後,将公鑰分發到三台機器上。

繼續閱讀