0 说明
本文基于Ambari-2.7.7版本进行源码编译。所需的编译资料统一提供如下:
链接:https://pan.baidu.com/s/1F2D7zBGfKihxTBArnOilTw
提取码:8m17
1 前提条件
1.1 下载ambari源码包
wget https://github.com/apache/ambari/releases/tag/release-2.7.7-rc0/ambari-release-2.7.7-rc0.tar.gz
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.7/apache-ambari-2.7.7-src.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/ambari/ambari-2.7.7/apache-ambari-2.7.7-src.tar.gz
选择其中一个下载一个就行,下载完成后解压
tar -zxvf apache-ambari-2.7.7-src.tar.gz
chown -R root:root apache-ambari-2.7.7-src
1.2 需要安装软件
java | 1.8.0_201 |
---|---|
maven | Apache Maven 3.8.6 |
rpm-build | rpm-build-4.11.3-48.el7_9.x86_64 |
gcc-c++ | 4.8.5 |
python | 2.7.5 |
python-devel | python-devel-2.7.5-92.el7_9.x86_64 |
git | 1.8.3.1 |
nodejs | v4.5.0 |
注:①rpm-build安装
yum install rpm-build -y
查看rpm-build版本
② python-devel安装
yum install python-devel -y
查看安装版本
③ 安装node
wget https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz
tar -zxvf node-v4.5.0-linux-x64.tar.gz -C /usr/lib/node
安装完成后确保npm和node命令正常
注:如果执行npm -v时发生如下报错:
Cannot find module ‘npmlog’
解决办法:
# cd 命令进入nodejs安装目录然后执行如下命令,建立软连接:
ln -s ../lib/node_modules/npm/bin/npm-cli.js
④ 将以上安装的jdk/maven/node配置环境变量
#java environment
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:${JAVA_HOME}/jre:${JAVA_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin
#maven environment
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.6
export M2_HOME=/usr/local/maven/apache-maven-3.8.6
export PATH=$PATH:$MAVEN_HOME/bin
#node
export NODE_HOME=/usr/lib/node-v4.5.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin
1.3 maven镜像源配置
编辑 conf/settings.xml 配置文件,添加好下述镜像源,会提高编译ambari的速度。
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|-->
<settings
xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>/usr/local/maven/apache-maven-3.8.6/repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->
<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>
-->
</proxies>
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>
-->
<!-- Another sample, using keys to authenticate.
<server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>
-->
</servers>
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>
-->
<!-- Amabri build mirror source -->
<mirror>
<id>huaweicloud</id>
<name>huaweicloud maven</name>
<mirrorOf>central</mirrorOf>
<url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>alimaven</id>
<!-- <mirrorOf>central</mirrorOf> -->
<mirrorOf>central,apache.snapshots.https,maven2-repository.dev.java.net,maven2-glassfish-repository.dev.java.net,maven2-repository.atlassian,apache.staging.https,oss.sonatype.org,spring-milestones</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>nexus-hortonworks</id>
<mirrorOf>central</mirrorOf>
<name>Nexus hortonworks</name>
<url>https://repo.hortonworks.com/content/groups/public/</url>
</mirror>
<mirror>
<id>HDPReleases</id>
<name>HDP Releases</name>
<url>https://repo.hortonworks.com/content/repositories/releases/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>WSO2Releases</id>
<name>WSO2 Dist Repository</name>
<url>http://dist.wso2.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>MavenCentralReleases</id>
<name>Maven Central Repository</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<!-- profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin - like cactus - that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
| section of this document (settings.xml) - will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|-->
<profiles>
<!-- profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id's for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>
-->
<!--
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| ...
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| ...
|
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>
-->
<profile>
<id>huaweicloud</id>
<repositories>
<repository>
<id>huawei</id>
<url>https://repo.huaweicloud.com/repository/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>nexus-aliyun</id>
<repositories>
<repository>
<id>aliyun</id>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>alimaven</id>
<repositories>
<repository>
<id>ali</id>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>nexus-hortonworks</id>
<repositories>
<repository>
<id>hortonworks</id>
<url>https://repo.hortonworks.com/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>HDPReleases</id>
<repositories>
<repository>
<id>HDP</id>
<url>https://repo.hortonworks.com/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>WSO2Releases</id>
<repositories>
<repository>
<id>WSO2</id>
<url>http://dist.wso2.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>MavenCentralReleases</id>
<repositories>
<repository>
<id>MavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>huaweicloud</activeProfile>
<activeProfile>nexus-aliyun</activeProfile>
<activeProfile>alimaven</activeProfile>
<activeProfile>nexus-hortonworks</activeProfile>
<activeProfile>HDPReleases</activeProfile>
<activeProfile>WSO2Releases</activeProfile>
<activeProfile>MavenCentralReleases</activeProfile>
</activeProfiles>
<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>
-->
</settings>
1.4 将 HDP 3.0 和 3.1 文件拷贝到源码中
HDP3.0/HDP3.1获取连接如下:
将HDP3.0/HDP3.1拷贝到apache-ambari-2.7.7-src/ambari-server/src/main/resources/stacks/HDP目录下:
1.5 编译加速
1.5.1 下载bower_components
ambari编译时需要去apache-ambari-2.7.7-src/ambari-admin/src/main/resources/ui/admin-web/app/目录下载bower_components内容,由于网络原因不能下载,可以自行下载放入该目录下,再重新编译。
注意:如果未做该操作可能会报4.1中的错误
1.5.2 下载编译metrics所需依赖
修改ambari-metrics/pom.xml文件,将habse、hadoop、phoenix和grafana的下载路径进行替换
<hbase.tar>http://192.168.5.78/compile-ambari/hbase-2.4.2-bin.tar.gz</hbase.tar><hadoop.tar>http://192.168.5.78/compile-ambari/hadoop-3.1.1.tar.gz</hadoop.tar>
<grafana.tar>http://192.168.5.78/compile-ambari/grafana-6.7.4.linux-amd64.tar.gz</grafana.tar>
<phoenix.tar>http://192.168.5.78/compile-ambari/phoenix-hbase-2.4-5.1.2-bin.tar.gz</phoenix.tar>
注意:① 这里的192.168.5.78已配置httpd功能,可以通过该下载方式下载所需的依赖包
② 如果不做任何修改则在编译时会报4.2所示错误
③ 如果没有配置httpd,也可以配置为本地路径。例如:
<hbase.tar>file:///opt/compile-ambari/hbase-2.4.2-bin.tar.gz</hbase.tar>
<hbase.folder>hbase-2.4.2</hbase.folder>
<hadoop.tar>file:///opt/compile-ambari/hadoop-3.1.1.tar.gz</hadoop.tar>
<hadoop.folder>hadoop-3.1.1</hadoop.folder>
<grafana.folder>grafana-6.7.4</grafana.folder>
<grafana.tar>file:///opt/compile-ambari/grafana-6.7.4.linux-amd64.tar.gz</grafana.tar>
<phoenix.tar>file:///opt/compile-ambari/phoenix-hbase-2.4-5.1.2-bin.tar.gz</phoenix.tar>
<phoenix.folder>phoenix-hbase-2.4-5.1.2</phoenix.folder>
1.5.3 修改ambari-infra/ambari-infra-assembly/pom文件
<solr.tar>http://archive.apache.org/dist/lucene/solr/${solr.version}/solr-${solr.version}.tgz</solr.tar>
改为:
<solr.tar>http://192.168.5.78/compile-ambari/solr-${solr.version}.tgz</solr.tar>
注:如果没有安装httpd服务的节点,也可设置为本地路径,同上
1.5.4 修改ambari-infra/ambari-infra-solr-client/pom文件
<lucene6-core.url>https://repo1.maven.org/maven2/org/apache/lucene/lucene-core/${lucene6.version}/${lucene6-core-jar.name}</lucene6-core.url>
<lucene6-backward-codecs.url>https://repo1.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/${lucene6.version}/${lucene6-backward-codecs-jar.name}</lucene6-backward-codecs.url>
改为:
<lucene6-core.url>http://192.168.5.78/compile-ambari/${lucene6-core-jar.name}</lucene6-core.url>
<lucene6-backward-codecs.url>http://192.168.5.78/compile-ambari/${lucene6-backward-codecs-jar.name}</lucene6-backward-codecs.url>
注:如果没有安装httpd服务的节点,也可设置为本地路径,同上
1.5.6 替换maven仓库依赖
如果网络不好的小伙伴,可以直接使用我提供的maven仓库,将该依赖库直接解压到自己本地环境的maven仓库中再进行编译。
1.5.7 赋予所有执行权限
为确保编译过程中无可执行权限导致的报错,在编译前可以对所有ambari编译目录文件赋予可执行的权限
chmod -R 777 apache-ambari-2.7.7/
注:如果不执行上述操作,在编译时可能报如下错误:
[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)
2 编译
① 编译ambari的话,如果有自定义版本号的要求,可以先给ambari源码打上自己定义的版本号。打版本号其实就是通过mvn命令自动修改pom.xml文件里面的version值,包括子模块。
②通过mvn命令,将ambari各模块源码编译,最终得到各自的rpm包,类似hortonworks官方提供的ambari相关rpm包。
2.1 打版本号
给ambari源码打版本号,版本号可自定义
mvn versions:set -DnewVersion=2.7.7.0.1
2.2 ambari-metrics模块
pushd ambari-metrics
# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1
2.3 ambari-logsearch模块
# 返回到ambari根目录
popd
pushd ambari-logsearch
# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1
2.4 ambari-infra模块
# 返回到ambari根目录
popd
pushd ambari-infra
# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1
2.5 开始编译所有模块
# 返回到ambari根目录
popd
mvn -B -X install rpm:rpm -DnewVersion=2.7.7.0.1 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6" -Drat.skip=true
建议将上述命令全量复制,需要buildNumber,否则等rpm包安装时,会报buildNumber错误;-Drat.skip=true会跳过license校验。
编译成功
3 编译说明
ambari 源码分为多个模块,当某个模块编译失败时,我们想继续从这个模块开始编译,怎么做呢?
举个例子,假如 ambari-web 模块编译报错,只需要在编译命令的末尾添加:-rf :ambari-web 即可。当报错时显示的模块名,会在 mvn 输出的最后一行显示。
4 编译过程报错
4.1 Admin View报错
具体报错内容
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-admin: Failed to run task: 'yarn install --ignore-engines --pure-lockfile' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-admin: Failed to run task
bower angular-bootstrap#0.11.0 ECMDERR Failed to execute "git ls-remote --tags --heads https://github.com/angular-ui/bootstrap-bower.git", exit code of #128 fatal: unable to access 'https://github.com/angular-ui/bootstrap-bower.git/': Empty reply from server
这是由于ambari编译时需要去apache-ambari-2.7.7-src/ambari-admin/src/main/resources/ui/admin-web目录下载bower_components内容,由于网络原因不能下载,可以自行下载放入该目录下,再重新编译即可。
4.2 Ambari Metrics Collector报错
解决方法:
方式①
需要去掉ambari项目中pom.xml文件中的metric模块,删除后再重新编译即可
方式②
手动下载编译metrics需要的依赖包,并修改metrics的pom.xml文件。具体修改方法见1.5.2
4.3 缺少phoenix-core包
进入maven仓库下载该jar包,并将下载好的jar包放入maven中
4.4 未安装rpm-build
[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.4:rpm (default-cli) on project ambari: Unable to build the RPM: Error while executing process. Cannot run program "rpmbuild" (in directory "/root/ambari/apache-ambari-2.7.7-src/target/rpm/ambari/SPECS"): error=2, No such file or directory -> [Help 1]
解决办法:安装rpm-build
yum install -y rpm-build
4.5 yarn报错
Could not extract the Yarn archive: Could not extract archive
解决办法:
① 手动下载https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz
② 下载完成后手动放入maven仓库的com/github/eirslett/yarn/0.23.2/yarn-0.23.2./目录下即可
4.6 yarn install报错
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-web: Failed to run task: 'yarn install --ignore-engines --pure-lockfile' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-web: Failed to run task
解决办法:这个问题最容易出现,主要是nodejs会通过 yarn去加载依赖包,解决方式是保证网络环境好。确保网络环境没问题之后删除编译报错目录下的*.lock文件(个人将target目录一起删除),重新编译
# find ~/.m2/repository/ -name "*.lastUpdated" -exec rm -rf {} \;
4.7 ambari-admin报错
[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]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed.
解决办法:cd ambari-admin/src/main/resources/ui/admin-web目录下,编辑 .bowerrc ,修改后的内容如下:
{
"directory": "app/bower_components",
"allow_root": true
}
4.8 yarn报错
Could not download Yarn: Could not download https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz: Connect to objects.githubusercontent.com:443 [objects.githubusercontent.com/127.0.0.1, objects.githubusercontent.com/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused) -> [Help 1]
github的443端口不能访问
# 下载
https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz
# 放入maven仓库
repository/com/github/eirslett/yarn/1.1.0/yarn-1.1.0.tar.gz
5 编译包整理
Ambari 视图、ambari-metrics、ambari-logsearch、ambari-solr 都编译成功了。Ambari 源码全部编译完成后,我们需要将 ambari 各模块的编译包汇总起来。以 centos7 为例,我们需要将编译得到的 rpm 包汇总起来
5.1 合并rpm包
新建目录
mkdir ambari-2.7.7
汇总所有的rpm包,并制作生成yum源
cp -r ./ambari-server/target/rpm/ambari-server/RPMS/x86_64/ambari-server-2.7.7.0-1.x86_64.rpm ../ambari-2.7.7/
cp -r ./ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-2.7.7.0-1.x86_64.rpm ../ambari-2.7.7/
cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-solr/RPMS/noarch/ambari-infra-solr-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-solr-client/RPMS/noarch/ambari-infra-solr-client-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-manager/RPMS/noarch/ambari-infra-manager-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-logsearch/ambari-logsearch-assembly/target/rpm/ambari-logsearch-portal/RPMS/noarch/ambari-logsearch-portal-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-logsearch/ambari-logsearch-assembly/target/rpm/ambari-logsearch-logfeeder/RPMS/noarch/ambari-logsearch-logfeeder-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-collector/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-hadoop-sink/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-grafana/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-monitor/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-common/target/rpm/ambari-metrics-common/RPMS/noarch/
创建yum源
createrepo ./
执行完成后会生成repodata文件夹
注:如果报没有这个命令,安装一下createrepo即可
5.2 压缩ambari安装文件
tar -zcvf ambari-2.7.7.tar.gz ambari-2.7.7/
压缩完成即可
根据编译生成的ambari-2.7.7.tar.gz包即可以用于安装和部署amabri集群