Apache Ambari 源碼安裝

Apache Ambari 坑

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

倉庫鏡像設(shè)置
https://developer.aliyun.com/mirror/

接著安裝nodejs(實測Yum 安裝的nodejs版本很老,導(dǎo)致打包出問題)
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

環(huán)境變量設(shè)置

/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會去進行下載,因網(wǎng)速問題提前下載好

  1. 安裝 maven, JDK8

  2. 下載 python2.7 設(shè)置工具

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.

    這個問題最容易出現(xiàn),主要是nodejs會通過 yarn去加載依賴包,解決方式是保證網(wǎng)絡(luò)環(huán)境好

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

    有可能是因為網(wǎng)絡(luò)問題包沒有下載完整,我遇到了幾個包都不是完整的,所以直接去外面下載然后覆蓋到倉庫中

  • 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增加?。篹xport buildNumber=2.7.5.0 這里改為版本號即可
  1. 注意

有時候無故出現(xiàn)問題可以嘗試

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>

當(dāng)卡在下面代碼的時候背后在默默下載很多依賴包,此時要確保網(wǎng)絡(luò)良好,很有可能會出現(xiàn)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...

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容