目录

1.前言

2.编译环境安装

3.下载源码编译

4.大包提前下载

5.报错处理

5.1.报错

5.2.报错

5.3.报错

5.4.报错

5.5.报错

5.6.报错

5.7.报错

6.编译成功

7.官方说明


1.前言

本文讲解了在纯净CentOS7环境下,编译Ambari2.7.5所需进行的一系列操作及异常处理。

附参考资料连接:

编译官方说明

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

吐槽啊,此版本对应的HDP3.1.5无法下载,编译后也无法完成全部的部署……

官方说明打开较慢,为了方便大家,文末附官方说明。

2.编译环境安装

yum install -y java-1.8.0-openjdk

yum 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

tar xzvf apache-maven-3.6.3-bin.tar.gz

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

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

python get-pip.py

nodejs环境安装

yum install epel-release

yum install nodejs -y

升级nodejs

sudo npm install n -g

sudo n stable

vi ~/.bash_profile

添加

export PATH=/usr/local/bin/:$PATH:/root/apache-maven-3.6.3/bin

再执行

source ~/.bash_profile

安装yarn

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum install yarn

npm install -g bower

npm install -g gulp

3.下载源码编译

到http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.7.5

找到镜像服务器下载

https://mirrors.tuna.tsinghua.edu.cn/apache/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz

下载后解压

tar xfvz apache-ambari-2.7.5-src.tar.gz
cd apache-ambari-2.7.5-src
mvn versions:set -DnewVersion=2.7.5.0.0pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.5.0.0
popd#编译
mvn -B clean install rpm:rpm -DnewVersion=2.7.5.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

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

vi pom.xml

添加相应节点:

<repositories><repository><id>aliyun</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-apache snapshots</id><url>https://maven.aliyun.com/repository/apache-snapshots</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-central</id><url>https://maven.aliyun.com/repository/central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-google</id><url>https://maven.aliyun.com/repository/google</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-gradle-plugin</id><url>https://maven.aliyun.com/repository/gradle-plugin</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-jcenter</id><url>https://maven.aliyun.com/repository/jcenter</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-spring</id><url>https://maven.aliyun.com/repository/spring</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-spring-plugin</id><url>https://maven.aliyun.com/repository/spring-plugin</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-public</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-releases</id><url>https://maven.aliyun.com/repository/releases</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-snapshots</id><url>https://maven.aliyun.com/repository/snapshots</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-grails-core</id><url>https://maven.aliyun.com/repository/grails-core</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository><repository><id>aliyun-mapr-public</id><url>https://maven.aliyun.com/repository/mapr-public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository>
</repositories>
<pluginRepositories><pluginRepository><id>aliyun-plugin</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-apache snapshots</id><url>https://maven.aliyun.com/repository/apache-snapshots</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-central</id><url>https://maven.aliyun.com/repository/central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-google</id><url>https://maven.aliyun.com/repository/google</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-gradle-plugin</id><url>https://maven.aliyun.com/repository/gradle-plugin</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-jcenter</id><url>https://maven.aliyun.com/repository/jcenter</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-spring</id><url>https://maven.aliyun.com/repository/spring</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-spring-plugin</id><url>https://maven.aliyun.com/repository/spring-plugin</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-public</id><url>https://maven.aliyun.com/repository/public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-releases</id><url>https://maven.aliyun.com/repository/releases</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-snapshots</id><url>https://maven.aliyun.com/repository/snapshots</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-grails-core</id><url>https://maven.aliyun.com/repository/grails-core</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository><pluginRepository><id>aliyun-plugin-mapr-public</id><url>https://maven.aliyun.com/repository/mapr-public</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository>
</pluginRepositories>

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-6.4.2</grafana.folder>

<grafana.tar>https://dl.grafana.com/oss/release/grafana-6.4.2.linux-amd64.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地址,下载使用更快捷

5.报错处理

5.1.报错

[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

5.2.报错

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

解决

npm install pm2@latest -g

pm2 install pm2-slack

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

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

bower install --allow-root

5.3.报错

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是一个大于报错信息中的数量。

5.4.报错

ClassNotFoundException : Com.Sun.Jersey.Spi.Container.Servlet.ServletContainer

解决

vi ambari-metrics/ambari-metrics-timelineservice/pom.xml

添加依赖(注意version与其他一致即可)

<dependency>

<groupId>com.sun.jersey</groupId>

<artifactId>jersey-bundle</artifactId>

<version>1.11</version>

</dependency>

5.5.报错

[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

5.6.报错

/root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[22,33] 程序包com.sun.jersey.api.client不存在

解决

vi ambari-metrics/ambari-metrics-host-aggregator/pom.xml

添加依赖

<dependency>

<groupId>com.sun.jersey</groupId>

<artifactId>jersey-client</artifactId>

<version>1.11</version>

</dependency>

5.7.报错

[ERROR] /root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[31,34] 程序包org.codehaus.jackson.jaxrs不存在

[ERROR] /root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[49,55] 找不到符号

符号: 类 JacksonJaxbJsonProvider

位置: 类 org.apache.hadoop.metrics2.host.aggregator.AggregatorWebServiceTest

解决

vi ambari-metrics/ambari-metrics-host-aggregator/pom.xml

添加依赖

<dependency>

<groupId>org.codehaus.jackson</groupId>

<artifactId>jackson-jaxrs</artifactId>

<version>1.9.13</version>

</dependency>

注意要看清是codehaus的,不是fasterxml的,别添加错了

6.编译成功

[INFO] Rat check: Summary over all files. Unapproved: 0, unknown: 0, generated: 0, approved: 17 licenses.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Ambari Main 2.7.5.0.0 .............................. SUCCESS [  5.378 s]
[INFO] Apache Ambari Project POM 2.7.5.0.0 ................ SUCCESS [  0.170 s]
[INFO] Ambari Web 2.7.5.0.0 ............................... SUCCESS [01:00 min]
[INFO] Ambari Views 2.7.5.0.0 ............................. SUCCESS [  1.265 s]
[INFO] Ambari Admin View 2.7.5.0.0 ........................ SUCCESS [ 26.880 s]
[INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SUCCESS [ 15.939 s]
[INFO] ambari-metrics 2.7.5.0.0 ........................... SUCCESS [  0.626 s]
[INFO] Ambari Metrics Common 2.7.5.0.0 .................... SUCCESS [  4.607 s]
[INFO] Ambari Metrics Hadoop Sink 2.7.5.0.0 ............... SUCCESS [  2.358 s]
[INFO] Ambari Metrics Flume Sink 2.7.5.0.0 ................ SUCCESS [  1.527 s]
[INFO] Ambari Metrics Kafka Sink 2.7.5.0.0 ................ SUCCESS [  1.630 s]
[INFO] Ambari Metrics Storm Sink 2.7.5.0.0 ................ SUCCESS [  1.693 s]
[INFO] Ambari Metrics Storm Sink (Legacy) 2.7.5.0.0 ....... SUCCESS [  1.743 s]
[INFO] Ambari Metrics Collector 2.7.5.0.0 ................. SUCCESS [02:56 min]
[INFO] Ambari Metrics Monitor 2.7.5.0.0 ................... SUCCESS [  2.459 s]
[INFO] Ambari Metrics Grafana 2.7.5.0.0 ................... SUCCESS [  1.618 s]
[INFO] Ambari Metrics Host Aggregator 2.7.5.0.0 ........... SUCCESS [  5.608 s]
[INFO] Ambari Metrics Assembly 2.7.5.0.0 .................. SUCCESS [01:00 min]
[INFO] Ambari Service Advisor 1.0.0.0-SNAPSHOT ............ SUCCESS [  0.531 s]
[INFO] Ambari Server 2.7.5.0.0 ............................ SUCCESS [03:25 min]
[INFO] Ambari Functional Tests 2.7.5.0.0 .................. SUCCESS [  0.550 s]
[INFO] Ambari Agent 2.7.5.0.0 ............................. SUCCESS [ 51.679 s]
[INFO] ambari-logsearch 2.7.5.0.0 ......................... SUCCESS [  1.299 s]
[INFO] Ambari Logsearch Appender 2.7.5.0.0 ................ SUCCESS [  0.262 s]
[INFO] Ambari Logsearch Config Api 2.7.5.0.0 .............. SUCCESS [  0.239 s]
[INFO] Ambari Logsearch Config JSON 2.7.5.0.0 ............. SUCCESS [  0.196 s]
[INFO] Ambari Logsearch Config Solr 2.7.5.0.0 ............. SUCCESS [  0.199 s]
[INFO] Ambari Logsearch Config Zookeeper 2.7.5.0.0 ........ SUCCESS [  0.185 s]
[INFO] Ambari Logsearch Config Local 2.7.5.0.0 ............ SUCCESS [  0.182 s]
[INFO] Ambari Logsearch Log Feeder Plugin Api 2.7.5.0.0 ... SUCCESS [  0.179 s]
[INFO] Ambari Logsearch Log Feeder Container Registry 2.7.5.0.0 SUCCESS [  0.346 s]
[INFO] Ambari Logsearch Log Feeder 2.7.5.0.0 .............. SUCCESS [  3.645 s]
[INFO] Ambari Logsearch Web 2.7.5.0.0 ..................... SUCCESS [ 55.186 s]
[INFO] Ambari Logsearch Server 2.7.5.0.0 .................. SUCCESS [  5.825 s]
[INFO] Ambari Logsearch Assembly 2.7.5.0.0 ................ SUCCESS [  0.176 s]
[INFO] Ambari Logsearch Integration Test 2.7.5.0.0 ........ SUCCESS [  0.887 s]
[INFO] ambari-infra 2.7.5.0.0 ............................. SUCCESS [  0.166 s]
[INFO] Ambari Infra Solr Client 2.7.5.0.0 ................. SUCCESS [01:03 min]
[INFO] Ambari Infra Solr Plugin 2.7.5.0.0 ................. SUCCESS [  0.490 s]
[INFO] Ambari Infra Manager 2.7.5.0.0 ..................... SUCCESS [  5.827 s]
[INFO] Ambari Infra Assembly 2.7.5.0.0 .................... SUCCESS [  0.165 s]
[INFO] Ambari Infra Manager Integration Tests 2.7.5.0.0 ... SUCCESS [  1.310 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:51 min
[INFO] Finished at: 2020-03-11T17:11:54+08:00
[INFO] ------------------------------------------------------------------------

成功

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

总结教训:

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

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

感慨啊

这么牛的开源项目还缺少maven依赖包配置,也是醉了……

7.官方说明

Build and install Ambari 2.7.5

Refer Ambari Development for prerequisites and additional information on how to build Apache Ambari.

Step 1: Download and build Ambari 2.7.5 source

Go to http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.7.5 and find the suggested mirror for download. The process to verify the download is described is at http://www.apache.org/dyn/closer.cgi#verify

wget https://www-eu.apache.org/dist/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz (use the suggested mirror from above) tar xfvz apache-ambari-2.7.5-src.tar.gz cd apache-ambari-2.7.5-src mvn versions:set -DnewVersion=2.7.5.0.0 pushd ambari-metrics mvn versions:set -DnewVersion=2.7.5.0.0 popd

RHEL (CentOS 7) & SUSE (SLES 12 SP2 & SP3):

mvn -B clean install rpm:rpm -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"

Ubuntu/Debian:

mvn -B clean install jdeb:jdeb -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"

Note: You need to have tools such as rpm-build tool, brunch, etc.  For details on prerequisites, please see Ambari Development.

Step 2: Install Ambari Server

Install the rpm package from ambari-server/target/rpm/ambari-server/RPMS/noarch/

[For CentOS 7]

yum install ambari-server*.rpm    #This should also pull in postgres packages as well.

[For SLES 12]

zypper install ambari-server*.rpm    #This should also pull in postgres packages as well.

[For Ubuntu/Debian]

apt-get install ./ambari-server*.deb   #This should also pull in postgres packages as well.

Step 3: Setup and Start Ambari Server

Run the setup command to configure your Ambari Server, Database, JDK, LDAP, and other options:

ambari-server setup

Follow the on-screen instructions to proceed.

Once set up is done, start Ambari Server:

ambari-server start

Step 4: Install and Start Ambari Agent on All Hosts

Note: This step needs to be run on all hosts that will be managed by Ambari.

Copy the rpm package from ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ and run:

[For CentOS 7]

yum install ambari-agent*.rpm

[For SLES 12]

zypper install ambari-agent*.rpm

[Ubuntu/Debian]

apt-get install ./ambari-agent*.deb

Edit /etc/ambari-agent/ambari.ini

... [server] hostname=localhost ...

Make sure hostname under the [server] section points to the actual Ambari Server host, rather than "localhost".

ambari-agent start

Step 5: Deploy Cluster using Ambari Web UI

Open up a web browser and go to http://<ambari-server-host>:8080.

Log in with username admin and password admin and follow on-screen instructions. Secure your environment by ensuring your administrator details are changed from the default values as soon as possible.

Under Install Options page, enter the hosts to add to the cluster.  Do not supply any SSH key, and check "Perform manual registration on hosts and do not use SSH" and hit "Next".

Ambari Development

转至元数据结尾

  • 由 Mahadev Konar创建, 最终由 Jonathan Hurley修改于 十一月 30, 2018

转至元数据起始

Checking out Ambari source

Follow the instructions under Checkout source code section of "How to contribute" guide.

We'll refer to the top-level "ambari" directory as AMBARI_DIR in this document.

Tools needed to build Ambari

The following tools are needed to build Ambari from source.

Alternatively, you can easily launch a VM that is preconfigured with all the tools that you need.  See the Pre-Configured Development Environment section in the Quick Start Guide.

  • xCode (if using Mac - free download from the apple store)
  • JDK 8 (Ambari 2.6 and below can be compiled with JDK 7, from Ambari 2.7, it can be compiled with at least JDK 8)
  • Apache Maven 3.3.9 or later

Tip: In order to persist your changes to the JAVA_HOME environment variable and add Maven to your path, create the following files:

File: ~/.profile

source ~/.bashrc

File: ~/.bashrc

export PATH=/usr/local/apache-maven-3.3.9/bin:$PATH

export JAVA_HOME=$(/usr/libexec/java_home)

export _JAVA_OPTIONS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

  • Python 2.6 (Ambari 2.7 or later require Python 2.7 as minimum supported version)
  • Python setuptools:

for Python 2.6: Download setuptools and run:

sh setuptools-0.6c11-py2.6.egg

for Python 2.7:  Download setuptools and run:

sh setuptools-0.6c11-py2.7.egg

  • rpmbuild (rpm-build package)
  • g++ (gcc-c++ package)

Running Unit Tests

  • mvn clean test
  • Run unit tests in a single module:

mvn -pl ambari-server test

  • Run only Java tests:

mvn -pl ambari-server -DskipPythonTests

  • Run only specific Java tests:

mvn -pl ambari-server -DskipPythonTests -Dtest=AgentHostInfoTest test

  • Run only Python tests:

mvn -pl ambari-server -DskipSurefireTests test

  • Run only specific Python tests:

mvn -pl ambari-server -DskipSurefireTests -Dpython.test.mask=TestUtils.py test

  • Run only Checkstyle and RAT checks:

mvn -pl ambari-server -DskipTests test

NOTE: Please make sure you have npm in the path before running the unit tests.

Generating Findbugs Report

  • mvn clean install

This will generate xml and html report unders target/findbugs. You can also add flags to skip unit tests to generate report faster.

Building Ambari

Note: if you can an error that too many files are open while building, then run: ulimit -n 10000 (for example)

To build Ambari RPMs, run the following.

Note: Replace ${AMBARI_VERSION} with a 4-digit version you want the artifacts to be (e.g., -DnewVersion=1.6.1.1)

Note: If running into errors while compiling the ambari-metrics package due to missing the artifacts of jms, jmxri, jmxtools:

[ERROR] Failed to execute goal on project ambari-metrics-kafka-sink: Could not resolve dependencies for project org.apache.ambari:ambari-metrics-kafka-sink:jar:2.0.0-0: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories WagonRepositoryConnectorFactory

The work around is to manually install the three missing artifacts:

mvn install:install-file -Dfile=jms-1.1.pom -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar

mvn install:install-file -Dfile=jmxtools-1.2.1.pom -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar

mvn install:install-file -Dfile=jmxri-1.2.1.pom -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar

If when compiling it seems stuck, and you've already increased Java and Maven heapsize, it could be that Ambari Views has a lot of artifacts, and the rat-check is choking up. In this case, try running

git clean -df (this will remove untracked files and directories)

mvn clean package -DskipTests -Drat.ignoreErrors=true

or

mvn clean package -DskipTests -Drat.skip

Setting the Version Using Maven

Ambari 2.8+ uses a newer method to update the version when building Ambari.

RHEL/CentOS 6:

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

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

SUSE/SLES 11

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

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

Ubuntu 12:

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

mvn -B clean install package jdeb:jdeb -DskipTests -Dpython.ver="python >= 2.6" -Preplaceurl

Ambari 2.7 and Earlier Releases (Deprecated)

RHEL/CentOS 6: 展开源码

SUSE/SLES 11 展开源码

Ubuntu 12: 展开源码

Ambari Server will create following packages

  • RPM will be created under AMBARI_DIR/ambari-server/target/rpm/ambari-server/RPMS/noarch.
  • DEB will be created under AMBARI_DIR/ambari-server/target/

Ambari Agent will create following packages

  • RPM will be created under AMBARI_DIR/ambari-agent/target/rpm/ambari-agent/RPMS/x86_64.
  • DEB will be created under AMBARI_DIR/ambari-agent/target

Optional parameters:

  • -X -e: add these options for more verbose output by Maven.  Useful when debugging Maven issues.
  • -DdefaultStackVersion=STACK-VERSION
  • Sets the default stack and version to be used for installation (e.g., -DdefaultStackVersion=HDP-1.3.0)
  • -DenableExperimental=true
  • Enables experimental features to be available via Ambari Web (default is false)
  • All views can be packaged in RPM by adding -Dviews parameter
    • mvn -B clean install package rpm:rpm -Dviews -DskipTests
  • Specific views can be built by adding --projects parameter to the -Dviews

    • mvn -B clean install package rpm:rpm --projects ambari-web,ambari-project,ambari-views,ambari-admin,contrib/views/files,contrib/views/pig,ambari-server,ambari-agent,ambari-client,ambari-shell -Dviews -DskipTests

NOTE: Run everything as root below.

Building Ambari Metrics

If you plan on installing the Ambari Metrics service, you will also need to build the Ambari Metrics project.

cd ambari-metrics

mvn clean package -Dbuild-rpm -DskipTests

For Ubuntu:

cd ambari-metrics

mvn clean package -Dbuild-deb -DskipTests

Note:

The metrics rpms will be found at: ambari-metrics-assembly/target/. These would be need for installing the Ambari Metrics service.

Running the Ambari Server

First, install the Ambari Server RPM.

On RHEL/CentOS:

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

On SUSE/SLES:

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

On Ubuntu 12:

dpkg --install ambari-server/target/ambari-server-*.deb          # Will fail with missing dependencies errors

apt-get update                                                   # Update locations of dependencies

apt-get install -f                                               # Install all failed dependencies

dpkg --install ambari-server/target/ambari-server-*.deb          # Will succeed

Initialize Ambari Server:

ambari-server setup

Start up Ambari Server:

ambari-server start

See Ambari Server log:

tail -f /var/log/ambari-server/ambari-server.log

To access Ambari, go to

http://{ambari-server-hostname}:8080

from your web browser and log in with username admin and password admin.

Install and Start the Ambari Agent Manually on Each Host in the Cluster

Install the Ambari Agent RPM.

On RHEL/CentOS:

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

SUSE/SLES:

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

Ubuntu12:

dpkg --install ambari-agent/target/ambari-agent-*.deb

Edit the location of Ambari Server in /etc/ambari-agent/conf/ambari-agent.ini by editing the hostname line.

Start Ambari Agent:

ambari-agent start

See Ambari Agent log:

tail -f /var/log/ambari-agent/ambari-agent.log

Setting up Ambari in Eclipse

$ mvn clean eclipse:eclipse

After doing the above you should be able to import the project via Eclipse "Import > Maven > Existing Maven Project". Choose the root directory where you cloned the git repository. You should be able to see the following projects on eclipse:

ambari

|

|- ambari-project

|- ambari-server

|- ambari-agent

|- ambari-web

Select the top-level "ambari pom.xml" and click Finish.

Coding Guidelines for Ambari

CentOS7 Ambari2.7.5编译相关推荐

  1. CentOS7 Ambari2.7.4编译

    目录 1.相关连接 2.编译 2.1.编译环境安装 2.2.下载源码 2.3.镜像加速 2.4.大包提前下载 2.5.各种错误处理 2.6.编译成功 1.相关连接 编译官方说明 https://cwi ...

  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. 数据库设计的酸(ACID)碱(BASE)原则
  2. UIExtendedEdge
  3. 关于 Session 的深入探讨
  4. Jenkins的卸载
  5. 一些Linux shell
  6. CNN: 查看tensorflow Pb模型所有层的名字
  7. Java排序之直接选择排序
  8. 排序字段设计_内容搜索排序表达式的最佳实践
  9. Python数据分析学习笔记03:NumPy基础(数组与向量化计算)
  10. python线程安全_线程,线程安全与python的GIL锁
  11. windows下安装node版本管理工具及nvm use切换不成功问题解决
  12. mysql连表查询效率,我就不信你还听不明白了!
  13. request.getParameter、request.getParameterValues、request.getParameterMap用法详解
  14. Matlab Coder杂记
  15. linux 如何清理垃圾文件,Linux系统怎样清理垃圾文件
  16. bert实践:关系抽取解读
  17. Google搜索打不开解决办法、Chrome小技巧
  18. 高数学习日记——矢量场与数量场的概念
  19. Oracle怎么获取json类型字符串值,sql解析json格式字段 如何获取json中某个字段的值?...
  20. 梁昌勇 软件工程_改进交互式蚁群算法及其应用

热门文章

  1. 前端学习(2509):脚手架开发
  2. 前端学习(2502):vue指令v-if
  3. “约见”面试官系列之常见面试题之第九十五篇之vue-router的组件组成(建议收藏)
  4. 前端学习(2242)以组件方式创建UI
  5. 前端学习(490):javascript实现
  6. java学习(130):treemap类
  7. 玩转oracle 11g(14):命令学习2
  8. FPGA Verilog实现一个脉冲波形变换
  9. 嵌入式开发中关键字_IO 和 volatile的用法
  10. 手机端双击页面放大的问题