---
title: "Centos7安装Ambari"
author: "username2"
date: "2018-04-28T17:01:26Z"
tags: []
categories: ["企业架构"]
slug: "centos7-ambari"
draft: false
lastmod: "2018-04-28T17:02:13Z"
id: 2420533
url: "https://username2.iteye.com/blog/2420533"
---

上一篇： centos7的安装： http://username2.iteye.com/admin/blogs/2390323

```
10、Ambari安装：

	https://ambari.apache.org/
	http://www.infocool.net/kb/OtherCloud/201611/214644.html

	Ambari-2.4.1.0 压缩包地址： 
	http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.1.0/ambari-2.4.1.0-centos7.tar.gz 
	HDP-2.5.0.0压缩包地址： 
	http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.0.0/HDP-2.5.0.0-centos7-rpm.tar.gz 
	HDP UTILS压缩包下载地址： 
	http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz 
	其他版本，下载地址请参考： 
	Ambari： 
	http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.1.0/bk_ambari-installation/content/ambari_repositories.html 
	HDP和HDP UTILS： 
	http://docs.hortonworks.com/HDPDocuments/Ambari-2.4.1.0/bk_ambari-installation/content/hdp_stack_repositories.html

11、安装apache并且解压上面的压缩文件到http的目录下面，DocumentRoot 目录下面：
   1) yum update 
    yum install httpd 
    2) 修改配置文件  /etc/httpd/conf/httpd.conf
	添加监听的地址和端口： ServerName 192.168.145.131:80
	可以修改监听的地址：DocumentRoot "/var/www/html"

    3）启动 /etc/httpd/httpd -k start/restart/stop 
    4)访问服务器192.168.145.131:80看到文件目录结构。
    5）两个项目的目录：
      http://192.168.145.131/HDP/centos7/
      http://192.168.145.131/

12、安装ambari-server

  cd /etc/yum.repos.d/
  wget -nv http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.1.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
  yum install ambari-server
  ambari-server setup
  vi /etc/ambari-server/conf/ambari.properties
  在最后添加client.api.port=18080即将ambari的端口修改为18080
  sudo ambari-server start
  在浏览器中输入http://192.168.145.131:18080
  出现的页面输入用户名和密码：admin/admin 
  到此ambari安装完成，下面安装集群。




 13、服务器复制为5份，设置所有机器的host，并且做互相免密登录
	ssh-keygen -t rsa

	ssh-copy-id  linux130.cn
	ssh-copy-id  linux132.cn
	ssh-copy-id  linux131.cn
	ssh-copy-id  linux133.cn
	ssh-copy-id  linux134.cn



 14、设置所有的host
	 sudo vi /etc/hosts

	192.168.145.131 linux131.cn linux131
	192.168.145.130 linux130.cn linux130
	192.168.145.129 linux132.cn linux132
	192.168.145.133 linux133.cn linux133
	192.168.145.134 linux134.cn linux134
下面这些用于设置ambari中的域名：
	linux131.cn
	linux130.cn
	linux132.cn
	linux133.cn
	linux134.cn 



15 、开启NTP服务，同步各个机器上的时钟
 yum -y install ntp
 systemctl is-enabled ntpd
 systemctl enable ntpd
 systemctl start ntpd
16、设置各个机器上的网络域名
	sudo vi  /etc/sysconfig/network
	NETWORKING=yes
	HOSTNAME=linux132.cn

17、如果防火墙没有关闭，需要关闭掉
	关闭防火墙和SELinux
	 systemctl disable firewalld
	 systemctl stop firewalld
	临时关闭，不用重启机器： 
		setenforce 0

	修改配置文件让机器重启也生效：  
	cat /etc/sysconfig/selinux
	SELINUX=disabled


18、根据ambari上的向导，安装hadoop相关
    名称：bigdata
    hdp的服务器要设置成私有的，并且设置为我们自己的11中小（5）给的地址，系统设置为redhad7，
    操作用户选择root，并且所有机器要有root账号的免密登录，上传ambari，server服务器上的id_rsa私钥
    下一步，然后ambari会检查各个机器的ssh的免密登录，并且会拷贝各个机器上一些文件。
    

如果虚拟机磁盘空间不足，则磁盘扩展：
    http://blog.csdn.net/icycolawater/article/details/6992722

19、访问装好的服务
http://192.168.145.131:18080

 
20、如果内存过少可能执行hadoop的命令比较慢，需要停止交换内存。

1）可以用以下两个命令清除刷新swap，先关闭在打开：swapoff -a（交换内存不用就直接关掉就好了） | swapon -a
2）建议物理内存剩余10%在使用交换分区： echo 10 > /proc/sys/vm/swappiness

21、执行hive命令会有几个错误：
1）hadoop如果为安全模式则执行：hadoop dfsadmin -safemode leave
2）权限的问题则在ambari上修改dfs.permissions=false


```