Apache Ambari 源码安装

Apache Ambari 坑

  1. 事先需要安装的工具
yum install -y git python-devel rpm-build gcc-c++

仓库镜像设置
https://developer.aliyun.com/mirror/

接着安装nodejs(实测Yum 安装的nodejs版本很老,导致打包出问题)
wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.gz
tar xvf node-v10.9.0-linux-x64.tar.gz
ln -s /opt/node-v10.9.0-linux-x64/bin/node /usr/bin/node
ln -s /opt/node-v10.9.0-linux-x64/bin/npm /usr/bin/npm

环境变量设置

/etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-2.el8_1.x86_64
export MAVEN_HOME=/opt/apache-maven-3.6.3
export PATH=$PATH:$MAVEN_HOME/bin:/opt/phantomjs-1.9.8-linux-x86_64/bin
export _JAVA_OPTIONS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

phantomjs在打包时会用到,如果在PATH路径找不到phantomjs会去进行下载,因网速问题提前下载好

  1. 安装 maven, JDK8

  2. 下载 python2.7 设置工具

wget https://files.pythonhosted.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea

sh setuptools-0.6c11-py2.7.egg
  1. 遇到的报错
  • 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.

    这个问题最容易出现,主要是nodejs会通过 yarn去加载依赖包,解决方式是保证网络环境好

  • Could not extract archive: '/root/.m2/repository/xxxxxxx

    有可能是因为网络问题包没有下载完整,我遇到了几个包都不是完整的,所以直接去外面下载然后覆盖到仓库中

  • failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (Bower install) on project ambari-admin: Command execution failed. Process exited with an error: 1

    安装git

  • 找不到 org.json.simple.JSONAware
    ambari-metrics/ambari-metrics-storm-sink-legacy/pom.xml
    增加json依赖包

    <dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1</version>
    </dependency>

  • Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project ambari-infra-solr-client: An Ant BuildException has occured: The following error occurred while executing this line:
    /opt/apache-ambari-2.7.3-src/ambari-infra/ambari-infra-solr-client/build.xml:39: java.net.UnknownHostException: central.maven.org

    在ambari-infra模块中有些pom.xml写的路径central.maven.org无法访问了,需要更换为https://repo1.maven.org
    具体方式可以进入ambari-infra搜索哪些文件包含central.maven.org:

 find ./ | xargs grep central.maven.org
  • /usr/sbin/ambari-server : line 33: buildNumber: unbound variable
    vim /usr/sbin/ambari-server, Line 33增加 :export buildNumber=2.7.5.0 这里改为版本号即可
  1. 注意

有时候无故出现问题可以尝试

a. 删除target目录
b. find /repo/ -name "*.lastUpdated" -exec rm -rf {} ;
c. 重新编译

为了提升速度把maven仓库改为aliyun

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

如果有些包无法下载则使用
<mirror>
<id>nexus-hortonworks</id>
<mirrorOf>*</mirrorOf>
<name>Nexus hortonworks</name>
<url>https://repo.hortonworks.com/content/groups/public/</url>
</mirror>

当卡在下面代码的时候背后在默默下载很多依赖包,此时要确保网络良好,很有可能会出现failed to run task: 'yarn install --ignore-engines --pure-lockfile' failed
[INFO] Running 'yarn install --ignore-engines --pure-lockfile' in /opt/apache-ambari-2.7.3-src/ambari-web
[DEBUG] Executing command line [/opt/apache-ambari-2.7.3-src/ambari-web/node/yarn/dist/bin/yarn, install, --ignore-engines, --pure-lockfile]
[INFO] yarn install v0.23.2
[ERROR] warning Ambari@2.4.0: No license field
[INFO] [1/4] Resolving packages...
[INFO] [2/4] Fetching packages...
[ERROR] warning fsevents@0.3.8: The platform "linux" is incompatible with this module.
[ERROR] warning fsevents@1.1.1: The platform "linux" is incompatible with this module.
[INFO] info "fsevents@0.3.8" is an optional dependency and failed compatibility check. Excluding it from installation.
[INFO] info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[INFO] [3/4] Linking dependencies...
[INFO] [4/4] Building fresh packages...

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容