Ambari编译——教程大纲3.0.0
# 一、环境准备与依赖梳理
在正式操作前,请务必参照环境准备 章节,提前完成所有依赖包安装与环境变量配置,包括 JDK、Maven、Node.js 及基础开发包,否则后续编译极易中断。
注意
环境未满足时,后续步骤将频繁遇到报错,务必逐项核查依赖与变量配置。
Kylin v10 提供的默认软件仓库中,部分包命名与 CentOS/RHEL 接近,因此在执行 yum install 时要特别注意依赖名称匹配。
# 二、源代码调整与前端依赖加速
# 2.1 优化 ambari-admin 构建流程 前端提速
在编译 ambari-admin 前端组件时,建议优化 frontend-maven-plugin 配置,引入国内源加速 Node.js 与 npm
依赖的拉取速度,可显著缩短构建等待时间。
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<nodeVersion>v4.5.0</nodeVersion>
<npmVersion>2.15.0</npmVersion>
<workingDirectory>src/main/resources/ui/admin-web/</workingDirectory>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<phase>generate-sources</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm install</id>
<phase>generate-sources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install --unsafe-perm --registry=https://registry.npmmirror.com</arguments>
</configuration>
</execution>
</executions>
</plugin>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

提示
加速 npm 拉取能有效减少前端依赖下载等待,尤其在构建 Ambari Admin UI 时能节省数分钟时间。
# 2.2 调整 ambari-agent 安装依赖 Kylin兼容
在 Kylin v10 环境中,如果直接安装编译好的 ambari-agent 包:
rpm -ivh ambari-server-3.0.0.0-2.2.0.ky10.x86_64
可能出现如下依赖错误:

问题原因
- Ambari 3.0.0 的
SPEC文件依旧声明python (>= 2.6) - Kylin v10 已不再提供
python软链接包,仅保留python3
解决思路
在源码目录中修改 ambari-agent.spec 及 build.properties 文件,将依赖统一替换为 python3,再重新编译生成适配 Kylin
v10 的 RPM 包。
详细教程
完整修改路径、文件内容及编译验证过程,请参考: 安装报错:Python(>=2.6) but is not installed
# 2.3 SSL_ERROR_SYSCALL报错处理 网络相关
在 Kylin v10 环境中,编译 Ambari 的前端依赖阶段,偶尔会遇到 SSL_ERROR_SYSCALL 报错。
其典型现象如下:
bower jquery#1.9.1 - 3 ECMDERR Failed to execute "git ls-remote ..."
fatal: unable to access 'https://github.com/jquery/jquery-dist.git/':
OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
2
3

问题表现
openssl s_client探针正常(TLS 握手没问题);curl -vI https://github.com报错,显示SSL_ERROR_SYSCALL;- 构建日志中
ambari-admin模块失败,提示exec-maven-plugin: Bower install出错。
根因推断
此类问题多见于 HTTP/2 / ALPN 与网络中间层(代理、防火墙)兼容性不足,在 Kylin v10 上尤为突出。
修复方案
具体修复方法请参考:SSL_ERROR_SYSCALL 的修复方法 核心思路是:强制 Git 使用 HTTP/1.1 协议,绕过不兼容的 HTTP/2 协商。
# 三、全量编译命令与参数说明
日常开发推荐使用以下 Maven 命令一键打包 RPM,结合多线程与跳过不必要检查:
特别注意
自2.2.0版本后,我们对ambari-release版本进行了定义,release 将严格根据Ambari-env来定义
mvn package install \
rpm:rpm \
-Drat.skip=true \
-Dcheckstyle.skip=true \
-Dspotbugs.skip=true \
-Pkylin10-x86_64 \
-DskipTests
2
3
4
5
6
7
8
9
笔记
建议优先充分利用主机硬件资源,多线程构建可提升数倍性能,但首次编译依然会因依赖拉取消耗较长时间。
编译效果截图如下:

# 四、编译产物与目录结构
编译成功后,所有 rpm 包会产出在各模块的 target/rpm 目录下。实际案例展示:
[root@kylin10 modules]# find /opt/modules/ambari3 -iname '*.rpm' -exec cp -rv '{}' /data/rpm-package/ambari3 ';'
'/opt/modules/ambari3/ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-3.0.0.0-0.ky10.x86_64.rpm' -> '/data/rpm-pack
age/ambari3'
'/opt/modules/ambari3/ambari-server/target/rpm/ambari-server/RPMS/x86_64/ambari-server-3.0.0.0-0.ky10.x86_64.rpm' -> '/data/rpm-p
ackage/ambari3'
2
3
4
5
同时可配合截图直观查看:

提示
如果在依赖安装、环境变量、网络下载等环节遇到异常,可查阅本站其他报错解决与编译排障专题,获取一键修复方案。
- 01
- Ambari开启Kerberos认证加密类型错误 Kylin V1011-05
- 02
- KERBEROS SERVICE CHECK 报错11-04