在centos7上使用本地库方式离线安装cdh5

一、环境配置

1、前提准备

  • 已配置静态ip
  • 准备一个完整的跟当前系统一样的,系统镜像iso文件:centos下载
  • 下载需要的cloudera manager的rpm包:下载链接
  • 下载cdh的parcel包:下载链接
  • 下载mysql的安装包:下载链接
  • 准备mysql的连接包:mysql-connector-java

2、配置hosts

将所有需要的机器安装如下格式配置到hosts文件中:

1.1.1.1  foo-1.example.com  foo-1
2.2.2.2  foo-2.example.com  foo-2
3.3.3.3  foo-3.example.com  foo-3
4.4.4.4  foo-4.example.com  foo-4

3、配置免密登录

使用如下命令生成公钥,并且copy给所有节点,包括自身

ssh-keygen   (一直回车即可)
ssh-copy-id  

注:也可以做成脚本,请自行网上查找。

4、关闭防火墙

systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service

5、设置交换分区

sysctl vm.swappiness=0
echo "vm.swappiness=0" > /etc/sysctl.conf

6、关闭透明大页

echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled

chmod +x /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" > /etc/rc.d/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" 

二、安装本地yum库

1、挂载系统镜像

  • 注意磁盘大小
 mkdir /mnt/cdrom
 mount -o loop os/CentOS-7-x86_64-Everything-1804.iso /mnt/cdrom/

2、配置repo

  • 将本地的yum配置文件备份
cd /etc/yum.repo.d/
mkdir repo_bak
mv Centos-* repo_bak/
  • 新建os.repo、cm.repo、mysql.repo文件,添加一下内容
[os]
name=os
baseurl=file:///mnt/cdrom
gpgcheck=0
[cm]
name=cm
baseurl=http:///cm/cdh
gpgcheck=0
[mysql]
name=mysql
baseurl=http:///mysql
gpgcheck=0

3、安装httpd

yum install httpd

4、安装createrepo

yum install createrepo

5、创建目录

cd /var/www/html
mkdir -p cm/cdh
mkdir -p cm/parcel
mkdir mysql
mkdir os

6、拷贝系统依赖和安装包

cp -rf /mnt/cdrom/* os/
cp /root/cdh/* cm/cdh/
cp /root/parcel/* cm/parcel
cp /root/mysql/* mysql/

7、初始化目录

cd /var/www/html/
createrepo cm
createrepo mysql
createrepo os

8、修改os.repo如下

[os]
name=os
baseurl=http:///os
gpgcheck=0

9、分发repo文件到所有节点

ssh   "mkdir /etc/yum.repo.d/repo_bak" 
ssh   "mv /etc/yum.repo.d/Centos-* /etc/yum.repo.d/repo_bak"
scp  /etc/yum.repo.d/*.repo :/etc/yum.repo.d/

三、安装CDH

1、安装jdk

yum install oracle-j2sdk1.7-*

2、安装mysql

rpm -qa | grep mariadb

rpm -e --nodeps <上述命令显示的rpm包>      ----移除已有的mariadb

yum install MySQL-*

service mysql start

mysql -uroot -p

set password for 'root'@'localhost'=password('root');   ----修改默认的root密码 

3、创建数据库

CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'amon';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'rman';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'hue';
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'sentry';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'nav';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'navms';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'oozie';

4、拷贝mysql连接包

mkdir /usr/share/java
cp mysql-connector-java-5.1.47.jar /usr/share/java/mysql-connector-java.jar

5、安装cloudera server

yum install cloudera-manager-daemons cloudera-manager-server

6、初始化数据库

/usr/share/cmf/schema/scm_prepare_database.sh --scm-host <安装cm的节点> -h <数据库的安装节点> mysql cm cm cm

7、启动cloudera server

systemctl start cloudera-scm-server

查看启动信息:

tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log

启动成功标志:

INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.

8、开始安装集群

浏览器访问以下地址:

http://:7180

你可能感兴趣的:(安装cdh)