|NO.Z.00001|——————————|Deployment|——|Hadoop&PB级离线数仓.v01|——|Hadoop.v01|基础环境配置|

一、配置环境规划
### --- vmware、linux版本

~~~     vmware版本:VMware-workstation-full-15.5.5-16285975.exe
~~~     Linux版本:CentOS-7-x86_64-DVD-1810.iso
### --- Linux主机配置参数

~~~     CPU:1块1核
~~~     内存:2GB
~~~     网络规划:四块网卡:NAT模式/仅主机模式/桥接模式/桥接模式
~~~     硬盘:2块硬盘:100GB/100GB
### --- 磁盘分区

~~~     /boot:1024MB
~~~     /swap:4096MB
~~~     /home:30G
~~~     /:65G
### --- 配置参数:

~~~     DATE & TIME:Asia/Shanghai timezone
~~~     SOFTWARE SELECTION:Minimal Install
二、配置规划:网络规划
  IP地址 主机名
第一台机器 192.168.1.121 Hadoop01
第二台机器 192.168.1.122 Hadoop02
第三台机器 192.168.1.123 Hadoop03
第四台机器 192.168.1.124 Hadoop04
第五台机器 192.168.1.125 Hadoop05
三、基础环境配置
### --- 配置主机IP地址

~~~     # 配置主机IP地址
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
NAME=ens33
ONBOOT=yes
IPADDR=192.168.1.121
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DNS2=8.8.8.8
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens34
BOOTPROTO=static
NAME=ens34
ONBOOT=yes
IPADDR=10.10.10.121
NETMASK=255.255.255.0
~~~     # 重启网络

[root@localhost ~]# systemctl restart network 
### --- 永久关闭selinux

~~~     # 永久关闭selinux
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=disabled
~~~     # 查看selinux状态
[root@localhost ~]# getenforce
Disabled
### --- 永久关闭firewalld
 
~~~     # 永久关闭firewalld
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
~~~     # 查看firewalld状态
[root@localhost ~]# systemctl status firewalld.service
### --- 配置主机hostname

~~~     # 配置主机hostname
[root@localhost ~]# vim /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
hostname=hadoop01
### --- 配置主机hosts文件

~~~     # 配置主机hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
 
192.168.1.121 hadoop01
192.168.1.122 hadoop02
192.168.1.123 hadoop03
192.168.1.124 hadoop04
192.168.1.125 hadoop05
三、配置主机yum源
### --- 配置本地yum源

[root@localhost ~]# mkdir /mnt/cdrom
[root@localhost ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom/
[root@localhost ~]# echo "/dev/sr0 /mnt/cdrom iso9660 defaults 0 0" >>/etc/fstab
[root@localhost yum.repos.d]# mkdir back
[root@localhost yum.repos.d]# mv * back/
[root@localhost yum.repos.d]# cp -a back/CentOS-Media.repo .
[root@localhost yum.repos.d]# vim CentOS-Media.repo  
[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
### --- 安装基础软件包

[root@localhost ~]# yum install -y  net-tools
[root@localhost ~]# yum install -y  net-tools vim lrzsz wget  gcc gcc-c++
[root@localhost ~]# yum install gcc make gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel zlib-devel vim lrzsz tree tmux lsof tcpdump wget net-tools iotop bc bzip2 zip unzip nfs-utils man-pages
四、配置主机免密登录
### --- 配置主机hosts文件

[root@localhost ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.121 hadoop01
192.168.1.122 hadoop02
192.168.1.123 hadoop03
192.168.1.124 hadoop04
192.168.1.125 hadoop05
### --- 在所有主机创建目录并赋予权限

[root@localhost ~]# mkdir -p /root/.ssh 
[root@localhost ~]# chmod 700 /root/.ssh
### --- 生成公钥私钥文件
~~~     是生成ssh密码的命令,-t 参数表示生成算法,
~~~     有rsa和dsa两种;-P表示使用的密码,这里使⽤用""空字符串表示无密码。

~~~     # 生成秘钥文件
[root@localhost ~]# ssh-keygen -t rsa -P ""
### --- 将公钥文件发送到其它节点
### --- 其它节点按照此配置

[root@localhost ~]# cd .ssh/
[root@localhost ~]# ssh-copy-id -i id_rsa.pub root@hadoop01
[root@localhost ~]# ssh-copy-id -i id_rsa.pub root@hadoop02
[root@localhost ~]# ssh-copy-id -i id_rsa.pub root@hadoop03
[root@localhost ~]# ssh-copy-id -i id_rsa.pub root@hadoop04
[root@localhost ~]# ssh-copy-id -i id_rsa.pub root@hadoop05
五、配置主机时间同步:
### --- ntp.server端配置:Hadoop01

~~~     # 查看当前服务端和客户端版本一致
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 
~~~     # hadoop01安装ntpdate

[root@localhost ~]# yum  install -y ntpdate
 
[root@localhost ~]# systemctl restart ntpdate
[root@localhost ~]# systemctl enable ntpdate
~~~     # 通过网络连接外网进行时钟同步,必须保证虚拟机连上外网
[root@localhost ~]# ntpdate us.pool.ntp.org;
17 Oct 12:56:25 ntpdate[7683]: adjust time server 50.205.57.38 offset 0.007918 sec

~~~     # 阿里云时钟同步服务器
~~~     集群中其他机器与这台机器定时的同步时间,比如,每 隔十分钟,同步一次时间。
[root@localhost ~]# ntpdate ntp4.aliyun.com 
17 Oct 12:57:22 ntpdate[7684]: adjust time server 203.107.6.88 offset -0.007126 sec
### --- 时间服务器配置(必须root用户)

~~~     # 安装ntpd服务
[root@localhost ~]# yum -y install ntp
~~~     # 启动ntpd的服务
[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# systemctl enable ntpd
### --- 编辑/etc/ntp.conf

~~~     # 编辑/etc/ntp.conf配置文件
[root@localhost ~]# vim /etc/ntp.conf
restrict default nomodify notrap nopeer noquery             # 第8行:开启配置始终同步广播地址
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap     # 开启17行;同步源:配置同步源

# server 0.centos.pool.ntp.org iburst                       # 第21~24行:注释掉
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
 
server 127.127.1.0 # local clock                            # 第25~26行:添加这两行
fudge 127.127.1.0 stratum 10
### --- 配置以下内容,保证BIOS与系统时间同步 vim /etc/sysconfig/ntpd添加一行内容

~~~     # 配置BIOS时间与系统时间同步
[root@localhost ~]# vim /etc/sysconfig/ntpd
SYNC_HWLOCK=yes
### --- 启动ntpd并设置开机自启动

~~~     # 启动ntpd服务
[root@localhost ~]# systemctl restart ntpd
[root@localhost ~]# systemctl enable ntpd 
### --- 配置ntp.client端服务:Hadoop02,Hadoop03,Hadoop04,Hadoop05

~~~     # 安装ntpdate服务
[root@localhost ~]# yum install -y ntpdate
 
[root@localhost ~]# systemctl restart ntpdate
[root@localhost ~]# systemctl enable ntpdate
~~~     # 在其他机器配置10分钟与时间服务器同步一次
[root@localhost ~]# crontab -e
*/10 * * * * /usr/sbin/ntpdate 192.168.1.121    # 注:另外两台机器与192.168.1.121进行时钟同步
~~~     # 修改任意机器时间
[root@localhost ~]# date -s "2020-06-20 11:11:11"

~~~     # 十分钟后查看机器是否与时间服务器同步
[root@localhost ~]# date
六、安装jdk:所有节点
### --- 查看自带的openjdk

~~~     # 查看系统自带的jdk环境
[root@localhost ~]# rpm -qa | grep java
~~~     # 如果有⾃自带的,卸载系统⾃自带的openjdk
[root@localhost ~]# rpm -e java-1.6.0-openjdk-1.6.0.41-1.13.13.1.el6_8.x86_64 tzdata-java-2016j-1.el6.noarch java-1.7.0-openjdk-1.7.0.131-2.6.9.0.el6_8.x86_64 --nodeps
### --- 安装jdk

~~~     # 所有软件安装路径
[root@localhost ~]# mkdir -p /opt/yanqi/servers
~~~     # 所有软件压缩包的存放路径
[root@localhost ~]# mkdir -p /opt/yanqi/software
### --- 上传jdk到/opt/yanqi/software路径下去,并解压

[root@localhost ~]# tar -zxvf jdk-8u141-linux-x64.tar.gz -C ../servers/
### --- 配置环境变量

[root@localhost ~]# vim /etc/profile
##JAVA_HOME
export JAVA_HOME=/opt/yanqi/servers/jdk1.8.0_231
export PATH=:$JAVA_HOME/bin:$PATH
#5、修改完成之后记得 source /etc/profile生效 
[root@linux121 ~]# source /etc/profile 
### --- 查看jdk版本

[root@localhost ~]# java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(19)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示