红联Linux门户
Linux帮助

CentOS 6.5下安装Ambari

发布时间:2015-03-29 21:50:48来源:linux网站作者:vmking

Linux系统:CentOS 6.5


一、准备工作:
1.基本工具
yum
rpm
scp
curl
wget
pdsh
前几个一般系统都自带了,pdsh需要自己装 : yum install pdsh
这个命令没有成功执行 自己下载pdsh.tar.bz2,用tar -jxvf filename.tar.bz解压。之后进入filename文件夹,执行./configure,然后执行make和make install命令。安装结束。

另:使用yum install pdsh没有成功的问题安装epel即可解决。epel是一个提供高质量软件包的项目。安装过程如下:
1.查看是否安装:rpm -q epel-release
2.若没有,使用rpm命令安装:rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm(也可手动下载安装包安装)
3.成功后查看其所依附的软件包:rpm -qR epel-release
4.导入key:rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
5.安装yum-priority:yum install yum-priorities
6.cd /etc/yum.repos.d
ls |grep epel
7.安装pdsh即可:yum install pdsh

ambari文档上说“The Python version shipped with SUSE 11, 2.6.0-8.12.2, has a critical bug that may cause the Ambari Agent to fail with 24 hours. If you are installing on
SUSE 11, please update all your hosts to Python version 2.6.8-0.15.1.”
使用yum update python命令更新python版本。

2.分别配置/etc/hosts和/etc/sysconfig/network
以ambari节点下修改hosts文件为例:(本机192.168.235.138,master节点ip地址为192.168.235.139,slave节点ip地址为192.168.235.140)

127.0.0.1 ambari
::1 ambari

192.168.235.139  master
192.168.235.140  slave

(修改主机名,比如改为ambari:
hostname ambari
vi /etc/sysconfig/network 在里面设置ambari
不必重启)

3.设置免密码登陆:
[root@ambari ~]# ssh-keygen
[root@ambari ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@ambari ~]# scp ~/.ssh/authorized_keys master:/root/.ssh/
[root@ambari ~]# scp ~/.ssh/authorized_keys slave:/root/.ssh/

4.关闭SELinux:
暂时关闭命令:setenforce 0
永久关闭命令:vi /etc/selinux/config
将其中的SELinux设置:为SELINUX=disabled

5.关闭防火墙:
永久关闭:chkconfig iptables off
关闭:/etc/init.d/iptables stop
(也可在setup中设置开机不开启防火墙)

6.设置关闭packagekit
vi /etc/yum/pluginconf.d/refresh-packagekit.conf
将enabled设为0

7. Optional: Configure the Local Repositorie(没有联网,或者配置很大的集群并想保持带宽)
参考:http://ambari.apache.org/1.2.2/installing-Hadoop-using-ambari/content/ambari-chap1-6.html


二、安装
1.下载repo文件
wget http://public-repo-1.hortonworks.com/ambari/centos6/1.x/GA/ambari.repo
cp ambari.repo /etc/yum.repos.d

2.安装epel repository
yum install epel-release
查看是否配置成功,命令:
yum repolist
若成功,则应显示(不同系统可能稍有不同):

repo id repo name status

HDP-UTILS-1.1.0.16 Hortonworks Data Platform Utils Version - HDP-UTILS-1. 61

Updates-ambari-1.x ambari-1.x - Updates 65

ambari-1.x Ambari 1.x 5

base CentOS-6 - Base 6,367

epel Extra Packages for Enterprise Linux 6 - x86_64 10,633

extras CentOS-6 - Extras 14

updates CentOS-6 - Updates 0

repolist: 17,145

之后安装ambari bits:

yum install ambari-server
这个命令同时安装了PostgreSQL。

3.执行命令:ambari-server setup
如果还没有关闭SELinux,执行这个命令的过程中会提示,选择y。然后会配置PostgreSQL,选择y自动下载安装jdk。之后配置数据库,选n使用默认数据库用户名ambari-server和密码bigdata,选y自己创建用户名密码。

执行命令ambari-server start启动服务。在浏览器中输入“主机名:8080”进入登陆界面,默认用户名密码为admin/admin。

可以修改端口号:
在/etc/ambari-server/conf/ambari.properties文件增加
client.api.port=<port_number>

查看ambari进程:ps -ef | grep Ambari
停止ambari进程:ambari-server stop
重启ambari进程:ambari-server restart