编译安装Ambari2.5.0

1.需要安装的工具

1.1     安装JDK  推荐1.8

1.2     安装Apache Maven 3.3.9

设置环境变量

# vi /etc/profile

export MAVEN_HOME="/opt/maven"

export path=$path: $MAVEN_HOME/bin

1.3     安装rpmbuild

1)检测rpm-build是否已经安装

[root@bigData-02 ~]# rpm -qa | grep rpm-build

 

2)安装

[root@bigData-02 ~]# yum install rpm-build

1.4     安装g++

  1. 检测

[root@bigData-02 ~]# rpm -qa | grep gcc-c++

 

  1. 安装

[root@bigData-02 ~]# yum install gcc-c++

1.5     安装NodeJS

  1. 下载

[root@bigData-02 ~]# wget http://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.gz

 

  1. 解压

[root@bigData-02 ~]# tar –zxvf node-v6.10.3-linux-x64.tar.gz

 

  1. 设置环境变量

[root@bigData-02 ~]# vi /etc/profile

export NODE_HOME="/opt/node"

export path=$path: $NODE_HOME/bin

 

[root@bigData-02 ~]#source /etc/profile

 

  1. 检测是否正确安装

[root@bigData-02 ~]# node -v

v0.10.33

 

[root@bigData-02 ~]# npm -v

1.4.28

1.6     安装Brunch

1)安装

[root@bigData-02 ~]# npm install -g brunch

 

  1. 检测

[root@bigData-02 ~]# brunch

 

  Usage: brunch [command] [options]

 

  Commands:

 

    new [skeleton] [path]  Create new brunch project in path [.]. Short-cut: n

    build [options]        Build a brunch project. Short-cut: b

    watch [options]        Watch brunch directory and rebuild if something changed. Short-cut: w

 

  Options:

 

    -h, --help     output usage information

-V, --version  output the version number

 

1.7     安装git

  1. 检测

[root@bigData-02 ~]# Git –version

 

  1. 安装

[root@bigData-02 ~]# yum install git

 

2 编译Ambari

2.1     下载

在官网下载最新版本2.5.0

解压之后上传到linux服务器上。

 

2.2     编译

进入到ambari的主目录中,执行mvn编译命令。

 

  1. ambari打上版本号

[root@bigData-02 ~]# 

mvn versions:set -DnewVersion=2.5.0.0.0

pushd ambari-metrics
mvn versions:set -DnewVersion= 2.5 . 0.0 . 0
popd

 


 

  1. 编译ambari

[root@bigData-02 ambari]# 


mvn -B clean install package rpm:rpm -DnewVersion=2.5.0.0.0 -DskipTests -Dpython.ver="python >= 2.6"


自此编译成功。

编译技巧:

1)需要注意的是此处maven编译大约要下载258M左右的依赖,在网络不好的情况下经常会出现time out的异常,并且需要反复编译,特别耗时,第一次编译大概花了一天时间,因此编译的时候可以对project进行逐个编译,节约时间。

2)项目中需要使用nodejs中的npm管理依赖,有些依赖特别难下载,下载好之后会存放在ambari-web/node_modules中,在下次编译的时候可以对ambari-web/node_modules备份,下次编译的时候,可以先对项目进行mvn clean删除,然后再将备份的node_modules拷入项目中,重新执行mvn install操作,可以节省很多时间。

psutils-compile错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin: 1.7 :run (psutils-compile) on project ambari-metrics-host-monitoring: An Ant BuildException has occured: exec returned: 1 [ERROR] around Ant part ... <exec failοnerrοr= "true" dir= "/root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil" executable= "/root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap" > ... @ 4 : 275 in /root/apache-ambari- 2.5 .0 -src/ambari-metrics/ambari-metrics-host-monitoring/target/antrun/build-psutils-compile.xml[ERROR] -> [Help 1 ] 

根据该错误信息,打开xml文件:

<?xml version="1.0" encoding="UTF-8" ?>
<project name="maven-antrun-" default="psutils-compile"  >
<target name="psutils-compile">
  <exec failοnerrοr="true" dir="/root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil" executable="/root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap">
    <arg value="setup.py"/>
    <arg value="build"/>
    <arg value="--build-platlib"/>
    <arg value="/root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build"/>
  </exec>
</target>
</project>

带上参数执行了一下wrap:

[root@bluejoe0 apache-ambari-2.5.0-src]# /root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/uniython-wrap setup.py build --build-platlib /root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build
/usr/bin/python2: can't open file 'setup.py': [Errno 2] No such file or directory
[root@bluejoe0 apache-ambari-2.5.0-src]# cd /root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil
[root@bluejoe0 psutil]# /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap setup.py build --build-platlib /root/apache-ambari-2.5.0-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build
running build
running build_py
running build_ext
building '_psutil_linux' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o
psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory
In file included from psutil/_psutil_linux.c:23:
psutil/_psutil_linux.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: In function ‘ioprio_get’:
psutil/_psutil_linux.c:50: warning: implicit declaration of function ‘syscall’


类似这样的错误,在网上查了一下,告知需要安装Python-devel版本,因此:

yuminstall python-devel


遇到没有安装setuptools的话,运行下面的语句。

yum instalpython-pip


2.3     安装RPM

Ambari安装需要ambari-server安装到管理机上,ambari-agent安装到集群节点上。

 

Ambari-serverrpm

ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server-*.noarch.rpm

 

Ambari-agentrpm

ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-*.rpm

操作指南,请查阅:


https://www.ibm.com/developerworks/cn/opensource/os-cn-bigdata-ambari/index.html


  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值