centos7 离线安装Ambari

准备工作

  • 新下载的centos7
  • 安装 createrepo,用于制作源
yum install createrepo
  • 安装java (推荐 java 1.7以上版本,如果有,则跳过此步骤)
yum install java
  • 安装高版本的openssl(各个host都需要安装,否则在ambari中安装服务的时候,会注册失败)
yum install openssl
  • 安装ncredhat-lsbhadoophbase都有依赖)
yum install nc
yum install redhat-lsb
  • 安装 gccpython -devel,python-libs 这类要成套
yum install gcc
yum install python-devel
yum install python-libs

 

配置环境

  • httpd服务,服务根目录是 /var/www/html
vi /etc/httpd/conf/httpd.conf

启用ServerName:把 #ServerName www.example.com:80 修改为 ServerName hostname:80

修改访问权限:

<Directory />

   Options FollowSymLinks

   AllowOverride None

   Order allow,deny

   Allow from all

</Directory>

将红色部分的Deny修改为Allow

 

  • 关闭SELinux服务,关闭防火墙,启动httpd服务
chkconfig iptables off
service firewalld stop    # 如果是centos6 命令是:service iptables stop
setenforce 0 service httpd start

打开浏览器,输入:http://hostname:80,如果能正确打开网页,则服务正常启动 

 

下载服务包

  • 下载HDP HDP-UTILS: 
wget -nv http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0/hdp.repo -O /etc/yum.repos.d/hdp.repo
#同步
Yum repolist
reposync -r HDP-UTILS-1.1.0.20
reposunc -r HDP-2.3.0.0
  • 下载Amabri
wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.2/ambari.repo -O /etc/yum.repos.d/ambari.repo
#同步
yum repolist
reposync -r Updates-ambari-2.1.2

 

制作离线源

把同步的HDP-2.3.0.0、 HDP-UTILS-1.1.0.20Updates-ambari-2.1.2,移动到 /var/www/html目录,分别进入三个目录,执行 createrepo ./

/var/www/html目录下,分别执行

mkdir -p ambari-2.1.2/centos7
mkdir -p /var/www/html/HDP/centos7/2.x/2.3.0.0
mkdir -p HDP-UTILS-1.1.0.20/repos/centos7

把同步下来的包分别移动到对应的目录

然后分别执行

createrepo /var/www/html/ambari-2.1.2/centos7
createrepo /var/www/html/HDP/centos7/2.x/2.3.0.0
createrepo /var/www/html/HDP-UTILS-1.1.0.20/repos/centos7

这样,离线源做好了

 

编写repo

备份/etc/yum.repo.d/下的所有文件,使yum安装就无法找到外网的源

mkdir bak
mv /etc/yum.repo.d/* bak/

创建文件 ambari.repo,写入内容:

 

#VERSION_NUMBER=2.1.2-377
[Updates-ambari-2.1.2]
name=ambari-2.1.2 - Updates
baseurl=http://<hostname>/ambari-2.1.2/centos7
gpgcheck=0
enabled=1

[HDP-2.3.0.0]
name=HDP Version - HDP-2.3.0.0
baseurl=http://<hostname>/hdp/HDP/centos7/2.x/updates/2.3.0.0
gpgcheck=0
enabled=1
 

[HDP-UTILS-1.1.0.20]
name=HDP Utils Version - HDP-UTILS-1.1.0.20
baseurl=http://<hostname>/HDP-UTILS-1.1.0.20/repos/centos7
gpgcheck=0
enabled=1

保存,然后执行

yum clean all
yum makecache

注意:红色加粗部分的<hostname> ,需要替换成提供httpd和离线镜像的主机的IP或者hostname

 

安装

然后开始安装ambari-server

PS:安装过程中提示依赖 Postgresql-server,则先需要安装postgresql-server,可以依照前面的下载镜像,制作镜像源来提供下载

Ambari-server setup

PS:需要设置JAVA_HOME的路径,或者下载安装(依照前面的下载镜像,制作离线镜像源)

 

执行:

Ambari-server start

 start 成功后,即可在网页上打开 ambari的web UI来安装hadoop集群。

如果遇到错误,请查看 /var/log/ambari-server/ambari-server.log中查找出错原因。

 

安装 hadoop

1,配置好hostip的映射

2,无密登录,把操作ambari-server的web UI的机器的rsa公钥发给要安装集群的各个主机,此处我假设操作网页的机器是PC0,要安装服务的是PC1,PC2,PC3

PC0: 

ssk-keygen -t rsa

scp ~/.ssh/id_rsa.pub root@PC1:~/

scp ~/.ssh/id_rsa.pub root@PC2:~/

scp ~/.ssh/id_rsa.pub root@PC3:~/

 

PC1,PC2,PC3:

#############################################################

修改/etc/ssh/sshd_config,确保一下服务开启

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile      .ssh/authorized_keys

#############################################################

#ssk-keygen -t rsa

cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

 

3,启动 ntpd

service ntpd start

4,关闭 iptables

service iptables stop

5,关闭LinuxTHP服务,需要重启

#centos6
vi /etc/grub.conf,添加 transparent_hugepage=never

#centos7:
vi /etc/default/grub
在有CMDLINE一行添加 transparent_hugepage=never
grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl disable tuned

重启之后,用下面的命令检查:

cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

有 [never]则表示THP被禁用

6,打开网页hostname:8080,用admin:admin登录,按照网页提示,开始安装hadoop集群

 

安装遇到的问题

opensslNetUtil.py 无法注册,需要yum upgrade openssl

Install,Start and Test这一步,等待时间长,可能出现比较多的错误:

1App Timeline server安装出错,retry解决;

2Heartbeat lost for the host错误,检查出错节点的ambari-agent是否停止,ambari-angentpython脚本运行的,可能遇到没有捕捉到的异常,导致进程crash或者停止了;

你可能感兴趣的:(centos7 离线安装Ambari)