Ambari 1.7 源码编译笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ambari 1.7 源码编译笔记相关的知识,希望对你有一定的参考价值。
环境CentOS 6.5
1.安装jdk
[[email protected] zzh]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
环境变量 :
[[email protected] zzh]# vi /etc/profile
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib.dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
2. 安装maven 3.0.5
下载 apache-maven-3.0.5-bin.tar.gz
环境变量:
vi /etc/profile
MAVEN_HOME=/opt/maven
PATH=$PATH:$MAVEN_HOME/bin
3. 安装python2.6
4.安装 rpm-build
[[email protected] zzh]# yum install rpm-build
5.安装gcc-c++
6.安装 nodejs
[[email protected] zzh]# wget http://nodejs.org/dist/v0.10.26/node-v0.10.26-linux-x64.tar.gz
环境变量:
[[email protected] opt]# vi /etc/profile
NODE_HOME=/opt/node
PATH=$PATH:NODE_HOME/bin
[[email protected] zzh]# source /etc/profile
检查
[[email protected] zzh]# node -v
v0.10.26
[[email protected] zzh]# npm -v
1.4.3
7.安装brunch
npm http GET https://registry.npmjs.org/brunch/1.7.20
npm http 200 https://registry.npmjs.org/brunch/1.7.20
....
/opt/node/bin/brunch -> /opt/node/lib/node_modules/brunch/bin/brunch
[email protected] /opt/node/lib/node_modules/brunch
8.安装setuptools
[[email protected] zzh]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65
[[email protected] zzh]# cd setuptools-12.0.3
[[email protected] zzh]# python setup.py install
8.获取ambari1.7.0源码并编译
[[email protected] zzh]# wget https://github.com/apache/ambari/archive/release-1.7.0.zip
[[email protected] zzh]# unzip release-1.7.0
[[email protected] zzh]# cd ambari-release-1.7.0/
[[email protected] ambari-release-1.7.0]# mvn versions:set -DnewVersion=1.7.0.0
[[email protected] ambari-release-1.7.0]# mvn -B clean install package rpm:rpm -DnewVersion=1.7.0.0 -DskipTests -Dpython.ver="python>= 2.6"
如果出现域名不能解析的情况
vi /etc/resolv.conf,增加
nameserver 8.8.8.8
nameserver 202.106.196.115
另,安装过程中出现了很多错误,解决过程记录如下:
错误1: --版本不匹配
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:regex-property (parse-package-version) @ ambari ---
[INFO] No match to regex ‘^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*‘ found in ‘1.7.0‘. The initial value ‘1.7.0‘ is left as-is...
[INFO]
[INFO] --- build-helper-maven-plugin:1.8:regex-property (parse-package-release) @ ambari ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Ambari Main ....................................... FAILURE [1.526s]
[INFO] Apache Ambari Project POM ......................... SKIPPED
[INFO] Ambari Web ........................................ SKIPPED
[INFO] Ambari Views ...................................... SKIPPED
[INFO] Ambari Admin View ................................. SKIPPED
[INFO] Ambari Server ..................................... SKIPPED
[INFO] Ambari Agent ...................................... SKIPPED
[INFO] Ambari Client ..................................... SKIPPED
[INFO] Ambari Python Client .............................. SKIPPED
[INFO] Ambari Groovy Client .............................. SKIPPED
[INFO] Ambari Shell ...................................... SKIPPED
[INFO] Ambari Python Shell ............................... SKIPPED
[INFO] Ambari Groovy Shell ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.846s
[INFO] Finished at: Fri Jan 29 06:57:20 PST 2016
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:1.8:regex-property (parse-package-release) on project ambari: No match to regex ‘^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-)(([0-9]+)|(SNAPSHOT)).*‘ found in ‘1.7.0‘. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
解决办法:
之前将1.7.0.0手误写成1.7.0导致,改成-DnewVersion=1.7.0.0即可
当然,也可以修改pom.xml代码:
[[email protected] ambari-release-1.7.0]# vi pom.xml
搜索“SNAPSHOT“,定位到111行: <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-)(([0-9]+)|(SNAPSHOT)).*</regex>
将之后的113行改为: <failIfNoMatch>false</failIfNoMatch>
[[email protected] ambari-release-1.7.0]# mvn -B clean install package rpm:rpm -DnewVersion=1.7.0 -DskipTests -Dpython.ver="python>= 2.6"
9. 错误2:安装过程中发现phantomjs无法下载--需手动安装phantomjs
[exec] > [email protected] install /root/zzh/ambari-1.7.0/ambari-web/node_modules/phantomjs
[exec] > node install.js
[exec]
[exec]
[exec]
[exec] PhantomJS not found on PATH
[exec] Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Saving to /root/zzh/ambari-1.7.0/ambari-web/node_modules/phantomjs/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Receiving...
[exec]
[exec]
[exec] Error making request.
[exec] Error: read ECONNRESET
[exec] at errnoException (net.js:904:11)
[exec] at TCP.onread (net.js:558:19)
..........................................................
INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Ambari Web ........................................ FAILURE [11:58.242s]
[INFO] Ambari Views ...................................... SKIPPED
[INFO] Ambari Admin View ................................. SKIPPED
[INFO] Ambari Server ..................................... SKIPPED
[INFO] Ambari Agent ...................................... SKIPPED
[INFO] Ambari Client ..................................... SKIPPED
[INFO] Ambari Python Client .............................. SKIPPED
[INFO] Ambari Groovy Client .............................. SKIPPED
[INFO] Ambari Shell ...................................... SKIPPED
[INFO] Ambari Python Shell ............................... SKIPPED
[INFO] Ambari Groovy Shell ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:00.978s
[INFO] Finished at: Fri Jan 29 07:50:00 PST 2016
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (compile) on project ambari-web: An Ant BuildException has occured: exec returned: 8
[ERROR] around Ant part ...<exec dir="/root/zzh/ambari-1.7.0/ambari-web" executable="brunch" failonerror="true">... @ 8:88 in /root/zzh/ambari-1.7.0/ambari-web/target/antrun/build-ambari-web-compile.xml
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
解决办法:
手动安装对应版本的phantomjs
[[email protected] zzh]# wget http://npm.taobao.org/mirrors/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
[[email protected] zzh]# vi /etc/profile
PHANTOMJS_HOME=/opt/phantomjs
PATH=$PATH:$PHANTOMJS_HOME/bin
[[email protected] zzh]# source /etc/profile
[[email protected] ambari-release-1.7.0]# mvn -B clean install package rpm:rpm -DnewVersion=1.7.0.0 -DskipTests -Dpython.ver="python>= 2.6" -rf ambari-web
错误3:安装过程中发现还是有错误,切换taobao的npm源:
npm config set registry
https://registry.npmjs.org/[[email protected] ambari-release-1.7.0]# npm config set registry https://registry.npm.taobao.org [[email protected] ambari-release-1.7.0]# npm info underscore (如果上面配置正确这个命令会有字符串response)
错误4:gyp:&
以上是关于Ambari 1.7 源码编译笔记的主要内容,如果未能解决你的问题,请参考以下文章
Build and install Ambari 2.7.5