目录

1.相关连接

2.编译

2.1.编译环境安装

2.2.下载源码

2.3.镜像加速

2.4.大包提前下载

2.5.各种错误处理

2.6.编译成功


1.相关连接

编译官方说明

https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development

部署官方说明

https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.7.5

git地址:https://github.com/apache/ambari

2.编译

2.1.编译环境安装

yum install -y java-1.8.0-openjdk-develyum install -y gcc-c++ rpm-build git

下载maven新版3.6.3(笔者实验时yum直接安装的maven是3.0.x,会提示需要3.1.0以上)

http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

curl http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -o apache-maven-3.6.3-bin.tar.gztar xzvf apache-maven-3.6.3-bin.tar.gz

#pip安装(官方中说安装setuptools即可,pip比较好装,包含了setuptools)

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.py

nodejs环境安装

yum install epel-releaseyum install nodejs -y

升级nodejs

sudo npm install n -gsudo n stable
vi ~/.bash_profile

添加

export PATH=/usr/local/bin/:$PATH:/root/apache-maven-3.6.3/binexport JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/export JRE_HOME=${JAVA_HOME}/jreexport CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libexport PATH=${JAVA_HOME}/bin:$PATH

再执行

source ~/.bash_profile

安装yarn等

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.reposudo yum install yarnnpm install -g bowernpm install -g gulp

2.2.下载源码

到github下载

https://github.com/apache/ambari/archive/release-2.7.4.tar.gz

下载后解压

tar xfvz apache-ambari-2.7.4-src.tar.gz cd apache-ambari-2.7.4-srcmvn versions:set -DnewVersion=2.7.4.0.0pushd ambari-metricsmvn versions:set -DnewVersion=2.7.4.0.0popdmvn -B clean install rpm:rpm -DnewVersion=2.7.4.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6" apache-rat:check -Drat.numUnapprovedLicenses=600

编译过程中失败,继续从该项目编译即可(mvn命令后添加参数如下,后面的ambari-metrics-host-monitoring就是提示的项目名)

mvn …… -rf :ambari-metrics-host-monitoring

2.3.镜像加速

觉得下载依赖包特别慢的,可以添加阿里云镜像

注意:后面下载storm源的时候会报找不到,此时把public的

<mirrorOf>*</mirrorOf>

改成

<mirrorOf>public</mirrorOf>

vi ${maven安装目录}/conf/settings.xml

  <mirrors><mirror><id>ali apache snapshots</id><url>https://maven.aliyun.com/repository/apache-snapshots</url><mirrorOf>apache snapshots</mirrorOf>   </mirror><mirror><id>ali central</id><url>https://maven.aliyun.com/repository/central</url><mirrorOf>central</mirrorOf>   </mirror><mirror><id>ali google</id><url>https://maven.aliyun.com/repository/google</url><mirrorOf>google</mirrorOf>   </mirror><mirror><id>ali gradle-plugin</id><url>https://maven.aliyun.com/repository/gradle-plugin</url><mirrorOf>gradle-plugin</mirrorOf>   </mirror><mirror><id>ali jcenter</id><url>https://maven.aliyun.com/repository/jcenter</url><mirrorOf>jcenter</mirrorOf>   </mirror><mirror><id>ali spring</id><url>https://maven.aliyun.com/repository/spring</url><mirrorOf>spring</mirrorOf>   </mirror><mirror><id>ali spring-plugin</id><url>https://maven.aliyun.com/repository/spring-plugin</url><mirrorOf>spring-plugin</mirrorOf>   </mirror><mirror><id>ali public</id><url>https://maven.aliyun.com/repository/public</url><mirrorOf>*</mirrorOf>   </mirror><mirror><id>ali releases</id><url>https://maven.aliyun.com/repository/releases</url><mirrorOf>releases</mirrorOf>   </mirror><mirror><id>ali snapshots</id><url>https://maven.aliyun.com/repository/snapshots</url><mirrorOf>snapshots</mirrorOf>   </mirror><mirror><id>ali grails-core</id><url>https://maven.aliyun.com/repository/grails-core</url><mirrorOf>grails-core</mirrorOf>   </mirror><mirror><id>ali mapr-public</id><url>https://maven.aliyun.com/repository/mapr-public</url><mirrorOf>mapr-public</mirrorOf>   </mirror></mirrors>

2.4.大包提前下载

hadoop等包

下载很慢,可以提前下载

vi ambari-metrics/pom.xml

找到

<hbase.tar>https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/hbase/hbase-2.0.2.3.1.4.0-315-bin.tar.gz</hbase.tar>

<hbase.folder>hbase-2.0.2.3.1.4.0-315</hbase.folder>

<hadoop.tar>https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/hadoop/hadoop-3.1.1.3.1.4.0-315.tar.gz</hadoop.tar>

<hadoop.folder>hadoop-3.1.1.3.1.4.0-315</hadoop.folder>

<grafana.folder>grafana-2.6.0</grafana.folder>

<grafana.tar>https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0.linux-x64.tar.gz</grafana.tar>

<phoenix.tar>https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/phoenix/phoenix-5.0.0.3.1.4.0-315.tar.gz</phoenix.tar>

<phoenix.folder>phoenix-5.0.0.3.1.4.0-315</phoenix.folder>

这一段,用下载工具下载下来(PS:迅雷可以直接镜像加速),在部署到自己本地的web服务器上,再修改这个pom.xml中的url地址,下载使用更快捷

2.5.各种错误处理

报错

[INFO] Downloading https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz to /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz

[INFO] No proxies configured

[INFO] No proxy was configured, downloading directly

[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz into /root/apache-ambari-2.7.5-src/ambari-web/node/tmp

……

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:install-node-and-yarn (install node and yarn) on project ambari-web: Could not extract the Node archive: Could not extract archive: '/root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz': EOFException -> [Help 1]

解决

手动下载

curl -o /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz

报错

[ERROR] warning fsevents@0.3.8: The platform "linux" is incompatible with this module.

解决

npm install pm2@latest -gpm2 install pm2-slack

(执行后上面的错误也还存在,但是可以往下走,这里发现了需要安装bower,安装这个即可)

安装bower的依赖包(个人在ambari-admin/src/main/resources/ui/admin-web/下执行)

bower install --allow-root

报错

Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project ambari: Too many files with unapproved license: 1 See RAT report in: /root/apache-ambari-2.7.5-src/target/rat.txt -> [Help 1]

解决(采用方案二)

一种方案是在新建的每一个类的第一行添加

/**

* Licensed to the Apache Software Foundation (ASF) under one

* or more contributor license agreements. See the NOTICE file

* distributed with this work for additional information

* regarding copyright ownership. The ASF licenses this file

* to you under the Apache License, Version 2.0 (the

* "License"); you may not use this file except in compliance

* with the License. You may obtain a copy of the License at

*

* http://www.apache.org/licenses/LICENSE-2.0

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/

第二种解决方案:

在mvn命令中添加参数

apache-rat:check -Drat.numUnapprovedLicenses=600

数字600是一个大于报错信息中的数量。

报错

PhantomJS not found on PATH

Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

[ERROR] Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2

[ERROR] Saving to /tmp/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2

[ERROR] Receiving...

[ERROR]

[ERROR] Error making request.

[ERROR] Error: read ECONNRESET

[ERROR] at exports._errnoException (util.js:907:11)

[ERROR] at TLSWrap.onread (net.js:557:26)

应该是下载超时了,网上说用cnpm,这个需要改编译过程,不合适

####不需要执行 npm install -g cnpm --registry=https://registry.npm.taobao.org

下载这个确实太久了,咱手动从淘宝镜像上下载

wget https://npm.taobao.org/mirrors/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2

cp phantomjs-2.1.1-linux-x86_64.tar.bz2 /tmp/phantomjs/

下载完2.1.1又会提示需要1.9.7

wget https://npm.taobao.org/mirrors/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2

cp phantomjs-1.9.7-linux-x86_64.tar.bz2 /tmp/phantomjs/

接下来又报错/tmp/npm_config_tmp/phantomjs/这个目录下也要下载phantomjs,一样的版本,都拷贝过去……

cp phantomjs-* /tmp/npm_config_tmp/phantomjs/

wget https://npm.taobao.org/mirrors/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2 -O /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2

后面还有……

wget https://npm.taobao.org/mirrors/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O /tmp/logsearch_npm_config_tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2

报错

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解决

yum install -y java-1.8.0-openjdk-devel

这个是安装jdk,yum install -y java-1.8.0-openjdk这个是安装jre,详见

yum search openjdk

java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment 8

java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment 8

报错

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

往上找,发现

[INFO] Running 'npm install --unsafe-perm' in /root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web

……

[INFO] --- exec-maven-plugin:1.2.1:exec (Bower install) @ ambari-admin ---

bower error Unexpected token {

Stack trace:

SyntaxError: Unexpected token {

at exports.runInThisContext (vm.js:53:16)

at Module._compile (module.js:373:25)

at Object.Module._extensions..js (module.js:416:10)

at Module.load (module.js:343:32)

at Function.Module._load (module.js:300:12)

at Module.require (module.js:353:17)

at require (internal/module.js:12:17)

at Object.<anonymous> (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/bower-registry-client/node_modules/request/lib/cookies.js:3:13)

at Module._compile (module.js:409:26)

at Object.Module._extensions..js (module.js:416:10)

Console trace:

Trace

at StandardRenderer.error (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/lib/renderers/StandardRenderer.js:72:17)

at Logger.<anonymous> (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/bin/bower:111:22)

at emitOne (events.js:77:13)

at Logger.emit (events.js:169:7)

at Logger.emit (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)

at /root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/lib/commands/index.js:40:20

at _rejected (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/q/q.js:797:24)

at /root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/q/q.js:823:30

at Promise.when (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/q/q.js:1035:31)

at Promise.promise.promiseDispatch (/root/apache-ambari-2.7.4-src/ambari-admin/src/main/resources/ui/admin-web/node_modules/bower/node_modules/q/q.js:741:41)

处理

vi ambari-admin/pom.xml

<argument>${basedir}/src/main/resources/ui/admin-web/node_modules/bower/bin/bower</argument>

改为

<argument>bower</argument>

报错

[exec] psutil/_psutil_linux.c:12:20: 致命错误:Python.h:没有那个文件或目录

[exec] #include <Python.h>

[exec] ^

[exec] 编译中断。

[exec] error: command 'gcc' failed with exit status 1

解决

yum install -y python-devel

报错

各种下载超时

[INFO] Downloading https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz to /root/.m2/repository/com/github/eirslett/yarn/1.1.0/yarn-1.1.0.tar.gz

解决

手动下载

mkdir -p /root/.m2/repository/com/github/eirslett/yarn/1.1.0/wget https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz -O /root/.m2/repository/com/github/eirslett/yarn/1.1.0/yarn-1.1.0.tar.gz

2.6.编译成功

……[INFO] Ambari Server ...................................... SUCCESS [04:18 min]
[INFO] Ambari Functional Tests ............................ SUCCESS [  3.061 s]
[INFO] Ambari Agent ....................................... SUCCESS [01:05 min]
[INFO] ambari-logsearch ................................... SUCCESS [  1.431 s]
[INFO] Ambari Logsearch Appender .......................... SUCCESS [  0.595 s]
[INFO] Ambari Logsearch Config Api ........................ SUCCESS [  2.027 s]
[INFO] Ambari Logsearch Config JSON ....................... SUCCESS [  0.253 s]
[INFO] Ambari Logsearch Config Solr ....................... SUCCESS [  0.449 s]
[INFO] Ambari Logsearch Config Zookeeper .................. SUCCESS [  0.512 s]
[INFO] Ambari Logsearch Config Local ...................... SUCCESS [  0.181 s]
[INFO] Ambari Logsearch Log Feeder Plugin Api ............. SUCCESS [  0.298 s]
[INFO] Ambari Logsearch Log Feeder Container Registry ..... SUCCESS [  0.462 s]
[INFO] Ambari Logsearch Log Feeder ........................ SUCCESS [  7.216 s]
[INFO] Ambari Logsearch Web ............................... SUCCESS [02:56 min]
[INFO] Ambari Logsearch Server ............................ SUCCESS [ 10.176 s]
[INFO] Ambari Logsearch Assembly .......................... SUCCESS [  0.185 s]
[INFO] Ambari Logsearch Integration Test .................. SUCCESS [  2.482 s]
[INFO] ambari-infra ....................................... SUCCESS [  0.221 s]
[INFO] Ambari Infra Solr Client ........................... SUCCESS [ 22.077 s]
[INFO] Ambari Infra Solr Plugin ........................... SUCCESS [  2.573 s]
[INFO] Ambari Infra Manager ............................... SUCCESS [  7.893 s]
[INFO] Ambari Infra Assembly .............................. SUCCESS [  0.267 s]
[INFO] Ambari Infra Manager Integration Tests ............. SUCCESS [  1.871 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  09:25 min
[INFO] Finished at: 2020-04-10T11:42:14+08:00
[INFO] ------------------------------------------------------------------------

成功

编译好后的rpm包在

cd ambari-server/target/rpm/ambari-server/RPMS/x86_64/

ambari-server-2.7.4.0-0.x86_64.rpm

一系列漫长的折磨,断断续续两三天,终于成功了!

总结教训:

1.用阿里云镜像,能加速很多

2.了解几个常用的编译工具,问题出现在这些点上的时候要想到是不是他没安装的问题。

CentOS7 Ambari2.7.4编译相关推荐

  1. CentOS7 Ambari2.7.5编译

    目录 1.前言 2.编译环境安装 3.下载源码编译 4.大包提前下载 5.报错处理 5.1.报错 5.2.报错 5.3.报错 5.4.报错 5.5.报错 5.6.报错 5.7.报错 6.编译成功 7. ...

  2. centos7 访问php页面显示源码_运维干货分享:centos7下源码编译安装php-7.1.5(脚本)...

    PHP简介: PHP是一种创建动态交互性站点的强有力的服务器端脚本语言.PHP是目前动态网页开发中使用最为广泛的语言之一.PHP能运行在包括Windows.Linux等在内的绝大多数操作系统环境中. ...

  3. 7.1 pdo 宝塔面板php_运维干货分享:centos7下源码编译安装php-7.1.5(脚本)

    PHP简介: PHP是一种创建动态交互性站点的强有力的服务器端脚本语言.PHP是目前动态网页开发中使用最为广泛的语言之一.PHP能运行在包括Windows.Linux等在内的绝大多数操作系统环境中. ...

  4. OnlyOffice验证(二)在Centos7上部署OnlyOffice编译结果

    在Centos7上部署OnlyOffice编译结果   此处将尝试将OnlyOffice验证(一)DocumentServer编译验证的结果部署到Centos7上.并且使用其它服务器现有的Rabbit ...

  5. CentOS7下源码编译安装MySQL5.6.4

    CentOS7下源码编译安装MySQL5.6.4 写这篇博客的主要原因是:请看上一篇博客:CentOS7下更改MySQL5.6.4默认的数据存储位置.对,当初通过rpm安装的mysql5.6.4,一切 ...

  6. Ambari2.7整体编译+安装使用

    最近Ambari发布了新版本--v2.7.1,支持HDP_3.0.1版本,较Ambari2.6相比,最直观的感觉就是Web UI有了很大的改变,更加的美观:支持的hadoop相关组件,也是较新的版本: ...

  7. centos7 ambari2.6.1.5+hdp2.6.4.0 大数据集群安装部署

    2019独角兽企业重金招聘Python工程师标准>>> 转载请务必注明原创地址为:http://dongkelun.com/2018/04/25/ambariConf/ 前言 本文是 ...

  8. Centos7.5源码编译安装nodejs

    官方文档:https://nodejs.org/zh-cn/download/releases/ 我安装的是 #1.把安装包上传到/usr/local/node #2.创建一个node文件夹 #3.解 ...

  9. CENTOS7 虚拟机上安装编译OVS

    Cyber Security CentOS7安装ovs Step1:安装依赖 [root@VSW2 ~]# yum install gcc pkgconfig autoconf automake li ...

最新文章

  1. 生日小助手官方网站已经发布了!
  2. VMware vSphere 5.1 群集深入解析(二十一)- 存储I/O控制(SIOC)
  3. 从编码层面对比java和c#
  4. Java实现可视化迷宫
  5. 开始学习python标准库---os
  6. 关于IE浏览器以及Firefox下冒泡事件的响应层级
  7. java 同步块关键字_Java同步关键字,同步方法和块
  8. iOS底层探索之LLVM(三)——自定义Clang插件(下)
  9. c语言传送send 函数解析,C语言sendto()函数:经socket传送数据
  10. C++ Template用法总结
  11. 小程序获取微信登陆用户
  12. oracle hint firstrow,stored outlines迁移成SQL执行计划基线
  13. 【Linux】排查进程、挖矿病毒查找
  14. 口袋妖怪金心银魂详细图文攻略(下)及游戏下载
  15. [漫画]120430 混血男孩
  16. 黑苹果双系统安装教程macOS High Sierra 10.13.x
  17. 初中级前端面试复习总结(浏览器、HTTP、前端安全)
  18. 阿里巴巴、百度前端工程师 2015 暑期实习生面试经历
  19. 华为p10计算机器在哪,华为P10怎么连接电脑教程
  20. 国内云主机为什么那么贵?主要从4个方面来决定

热门文章

  1. 前端学习(2649):vue3.0的处理展示
  2. 前端学习(1284):node开发概述
  3. 前端学习(669):流程控制
  4. 前端学习(481):html得编码问题
  5. 第一百一十期:详解SpringBoot应用跨域访问解决方案
  6. 数字图像与数字图像处理
  7. html:(30):继承和特殊性
  8. 【JavaScript】appendChild一个的注意点之会删除原dom树节点
  9. 神经网络中的 Dropout 以及变体方法
  10. js原生实现点击事件只创建一个元素