vmware14安装CetOS7搭建cdh5.13.3环境(一)

创建:2019-4-25 22:37:00
更新参考资料:Centos 7 离线安装Cloudera Manager5 和CDH5.13.0
https://blog.csdn.net/Tx_Smile/article/details/78338110

一、前期准备工作

1、虚拟机安装

安装目录
【E:\vm_system\centos7\hadoop2】
镜像:CentOS-7-x86_64-Minimal-1810.iso
安装视频:
https://v.youku.com/v_show/id_XNDE1NDAwNDU3Ng==.html?spm=a2hzp.8244740.0.0
关键词:最小化,Sa123sa4,8000MB内存

1.1 备份vmware快照【minimal】

2、软件版本

jdk-8u211-linux-x64.tar.gz
https://v.youku.com/v_show/id_XNDE1NDAyNzgyMA==.html?spm=a2hzp.8244740.0.0
scala2.11.0
https://v.youku.com/v_show/id_XNDE1NDA0NzE0NA==.html?spm=a2h0j.11185381.listitem_page1.5!5~A
mysql-connector-java-5.1.47.tar
https://v.youku.com/v_show/id_XNDE1OTAxMTQ2OA==.html?spm=a2h9p.12366999.app.55!255!255!25!3555552122TRTD!255!2H4~A

MySQL两种方案:
一种是下载rpm安装,但是要找依赖包
MySQL Server:mysql-community-server-5.7.26-1.el7.x86_64.rpm
MySQL Client:mysql-community-client-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-connector-java-5.1.47.tar.gz
方案二:下载yum安装。
mysql80-community-release-el7-3.noarch.rpm
CM:cloudera-manager-centos7-cm5.13.3_x86_64.tar.gz
CDH5:CDH-5.13.3-1.cdh5.13.3.p0.2-el7.parcel

3、集群设计

IP hostname 说明
192.168.100.100 cdh1 主,从节点3
192.168.100.101 cdh2 从节点2
192.168.100.102 cdh3 从节点3

二、安装前的配置

1、配置服务器

1.1 修改hostname(所有节点)

vi /etc/sysconfig/network
#配置内容
NETWORKING=yes
HOSTNAME=cdh1
:wq
hostname cdh1
hostname
#显示cdh1
reboot

阿里云轻量级服务器修改hostname
hostnamectl set-hostname master

1.2 修改IP

vmware设置网络模式hostonlny。
网段192.168.80.0,DHCP的IP范围改到200以后。

ip addr #看网卡名称ens32
vi /etc/sysconfig/network-scripts/ifcfg-ens32 #修改内容见下面
reboot
ip addr #再次查看IP
ping www.baidu.com #测试网络 —— 有外网的情况下

ifcfg-32内容修改为:

BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.80.100
GATEWAY=192.168.80.2
NETMASK=255.255.255.0
dns1=8.8.8.8 #内网不需要
dns2=114.114.114.114 #内网不需要

此时,应该可以用xmanager5登录服务器。

1.2.2 修改hosts

vi /etc/hosts

修改内容如下:
在这里插入图片描述

1.3 配置云仓库

1.3.1 阿里云

网页直接输入【
http://mirrors.aliyun.com/repo/Centos-7.repo

下载至本地。
用xmanager5上传到/etc/yum.repos.d。

cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak 
mv Centos-7.repo CentOS-Base.repo
yum clean all
yum makecache
yum update #过程需要几分钟。

1.3.2 本地云

将本地ISO做成FTP?

1.4 安装VIM(yum)

yum install vim -y

两次Y确定,等待几分钟下载。

1.4.1、保存vmware快照【preinstall】

2、安装JDK

2.1 卸载已有JDK

java -version #检查是否安装

2.2 上传JDK

cd /usr/local
mkdir -p ninja59k

xmanager上传【jdk-8u211-linux-x64.tar.gz】到【/usr/local】

cd /usr/local/ninja59k
cd /usr
mkdir -p java
cd /usr/local/ninja59k
tar -zxvf jdk-8u211-linux-x64.tar.gz -C /usr/java #需要几分钟

2.3 配置环境变量

vim /etc/profile
添加内容
#java
export JAVA_HOME=/usr/java/jdk1.8.0_211
export PATH=$PATH:$JAVA_HOME/bin
####
source /etc/profile #生效
java -version #检查版本
cd /usr/local/ninja59k
rm -f *.*

2.4 备份vmware快照【jdk8u211】

2.5 复制出两台虚拟机

cdh2
cdh3

2.6 关闭防火墙

systemctl status firewalld #查看状态
systemctl disable firewalld #开机禁用

2.7 关闭selinux

vi /etc/sysconfig/selinux
SELINUX=disabled
reboot
sestatus -v   #查看状态

2.8 时间同步

[root@cdh01~]yum -y install ntp #更改master的节点
[root@cdh01~]vi /etc/ntp.conf
    注释掉所有server *.*.*的指向,新添加一条可连接的ntp服务器(百度一下ntp服务器)
    server ntp.sjtu.edu.cn iburst
    在其他节点上把ntp指向master服务器地址即可(/etc/ntp.conf下)
    server 192.168.100.100 iburst 所有节点。

2.8.1 安装net-tools

mysql配置依赖项。

2.9 备份vmware快照【sshntp】

2.10 免密登录(所有节点)

在所有结点执行下列指令:

ssh-keygen
ssh-copy-id [email protected]
ssh-copy-id [email protected]
ssh-copy-id [email protected]

全部操作完后验证登录,在cdh2,cdh3上执行:

[root@cdh2 ~]# ssh [email protected]
Last login: Sat May  4 23:23:32 2019 from cdh3

2.10.1、保存vmware快照【preinstall2】


5、安装MYSQL5.7.26

5.1 卸载mariadb

mariadb与mysql有冲突,必须卸载。

[root@cdh1 usr]# rpm -qa | grep mariadb
mariadb-libs-5.5.60-1.el7_5.x86_64
[root@cdh1 usr]# rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64
[root@cdh1 usr]# rpm -qa | grep mariadb

5.2 安装MYSQL

只在主节点上执行。
mkdir -p /usr/local/ninja59k
方案一:(待定)
用xmanager将下列软件

安装顺序 文件名称
1 mysql-community-common-5.7.26-1.el7.x86_64.rpm
2 mysql-community-libs-5.7.26-1.el7.x86_64.rpm
3 mysql-community-client-5.7.26-1.el7.x86_64.rpm
4 mysql-community-server-5.7.26-1.el7.x86_64.rpm

上传到【/usr/local/ninja59k】

[root@cdh1 ~]# cd /usr/local/ninja59k/
[root@cdh1 ninja59k]# ls
mysql-community-client-5.7.26-1.el7.x86_64.rpm  mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm  mysql-community-server-5.7.26-1.el7.x86_64.rpm
[root@cdh1 ninja59k]# rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.26-1.e################################# [100%]
[root@cdh1 ninja59k]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-libs-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-5.7.26-1.el7################################# [100%]
[root@cdh1 ninja59k]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.26-1.e################################# [100%]
[root@cdh1 ninja59k]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	net-tools is needed by mysql-community-server-5.7.26-1.el7.x86_64

这时提示要安装net-toos

yum install net-tools -y
[root@cdh1 ninja59k]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.26-1.e################################# [100%]

方案二:
用xmanager将【mysql80-community-release-el7-3.noarch.rpm】上传到【/usr/local/ninja59k】

5.2.1 创建用户及用户组

groupadd mysql
useradd -r -g mysql mysql

授权远程登录:
mysql> grant all privileges on . to ‘root’@’%’ identified by ‘Sa123sa4’ with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

方案二:

参照官方说明:【
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

sudo rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
yum repolist all | grep mysql
yum -y install yum-utils
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community
yum repolist enabled | grep mysql
sudo yum install mysql-community-server

需要等待十几分钟,视网速决定。我这边进行到99%等了半小时。

5.2.4 备份vmware快照【mysqldownload】

5.2.5 启动服务

sudo systemctl start mysqld.service
sudo systemctl status mysqld.service #查看服务,绿色【running】表示正在执行。

5.2.6 修改默认密码

[root@cdh1 ~]# sudo grep 'temporary password' /var/log/mysqld.log #查找初始化密码
2019-04-28T01:12:11.777177Z 1 [Note] A temporary password is generated for root@localhost: oa#qaplWs4mm

记录:oa#qaplWs4mm
这个密码是随机的。

mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Sa123sa4';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

1)解决1819错误

参考文章 https://blog.csdn.net/kuluzs/article/details/51924374
这是因为默认密码规则要求不允许简单密码。

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_mixed_case_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_number_count=3;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_special_char_count=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=3;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'validate_password%';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Sa123sa4';
Query OK, 0 rows affected (0.00 sec)

5.2.7 测试MYSQL

mysql -u root -p
#输入Sa123sa4
ps -ef|grep mysql #查看安装路径
mysql      6722      1  0 21:12 ?        00:00:06 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root       6831   6759  0 22:03 pts/0    00:00:00 grep --color=auto mysql

5.2.8 备份vmware快照【mysqlroot】

5.2.9 使用远程navicat测试连接

设置NAVICAT客户端:
vmware14安装CetOS7搭建cdh5.13.3环境(一)_第1张图片
2
vmware14安装CetOS7搭建cdh5.13.3环境(一)_第2张图片

vmware快照列表

序号 快照名称
1 minimal
2 preinstall
3 sshntp
4 appendpack
5 jdk8
6 mysqlroot

参考文献:

https://my.oschina.net/u/3754001/blog/1819230

本文完,转下篇。2019-4-28 10:05:27截稿。

xxxxx1.5abcde 免密登录(备用方案)

xxxxx1.5.1 SSH生成公钥(影响到XMANAGER5)

ssh-keygen

[root@cdh1 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:nyWMukUfl4iU2gySICxK0nAUiQYoBW421IvBgPn1WbQ root@cdh1
The key's randomart image is:
+---[RSA 2048]----+
|&XBo   ..        |
|@Ooo..  .o       |
|B*o.+..oE        |
|+.o. .o* + . .   |
|      . S = +    |
|       o o *     |
|      . . +      |
|       o         |
|      .          |
+----[SHA256]-----+

默认生成【/root/.ssh/id_rsa】【/root/.ssh/id_rsa.pub】
将id_rsa.pub下载到WINDOWS本机。

2、第三方依赖包

yum install chkconfig python bind-utils psmisc libxslt zlib sqlite fuse fuse-libs redhat-lsb cyrus-sasl-plain cyrus-sasl-gssapi、

等待几分钟,下载时间很长。

2.1 备份vmware快照【appendpack】

完成时间:2019-4-27 15:32:47

4、安装Scala(待定?必选?)

4.1 安装

如果安装Spark,必须安装Scala,否则在web端操作CDH会报错。
此操作在所有节点上都要执行。
用xmanager将【scala-2.11.0.tgz】上传到【/usr/local】

cd /usr/local
tar -zxvf scala-2.11.0.tgz -C /usr
cd /usr
mv scala-2.11.0 scala2.11
vi /etc/profile
#添加内容
export SCALA_HOME=/usr/scala2.11
export PATH=$PATH:$SCALA_HOME/bin
#添加结束
source /etc/profile #生效
scala -version #检查版本

用xmanager删除刚才/usr/local下上传的安装包。

4.2 备份vmware快照【scala2】

你可能感兴趣的:(HADOOP)