ambari 2.7.6源碼編譯指南


編譯環境與基本軟件安裝

  • centos 7.6
  • maven 3.6.3

由於編譯相關jar包較難下載,所以本文提供僅用於ambari編譯的maven repository,將該repository替換原.m2/repository目錄即可。

repository.tar.gz

提取碼:ambari

軟件安裝

yum install -y wget git psutils python-devel rpm-build java-1.8.0-openjdk-devel

搭建http服務

yum install httpd

systemctl enable httpd

systemctl start httpd

提前下載如下安裝包

  • hadoop-3.1.1.tar.gz
  • hbase-2.0.2.tar.gz
  • grafana-6.7.4.linux-amd64.tar.gz
  • apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz

並將其放置到http服務的/var/www/html/compile-ambari目錄下(新建compile-ambari目錄)

源碼下載與修改

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

tar zxvf apache-ambari-2.7.6-src.tar.gz

cd apache-ambari-2.7.6-src

修改主目錄下的pom文件,新增hdp倉庫:

    <repository>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
        <checksumPolicy>warn</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
        <updatePolicy>never</updatePolicy>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
      <id>HDPReleases</id>
      <name>HDP Releases</name>
      <url>https://repo.hortonworks.com/content/repositories/releases/</url>
      <layout>default</layout>
    </repository>

修改ambari-metrics/pom.xml,將hbase、hadoop以及grafana的下載地址替換為本地地址:

    <hbase.tar>http://localhost/compile-ambari/hbase-2.0.2-bin.tar.gz</hbase.tar>
    <hadoop.tar>http://localhost/compile-ambari/hadoop-3.1.1.tar.gz</hadoop.tar>
    <grafana.tar>http://localhost/compile-ambari/grafana-6.7.4.linux-amd64.tar.gz</grafana.tar>
    <phoenix.tar>http://localhost/compile-ambari/apache-phoenix-5.0.0-HBase-2.0-bin.tar.gz</phoenix.tar>

執行編譯

mvn clean install rpm:rpm -DskipTests 

便可得到:

問題與解決方法

如果出現如下問題:

[INFO] [2/4] Fetching packages...
[ERROR] warning fsevents@2.3.2: The platform "linux" is incompatible with this module.
[INFO] info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.[INFO] [3/4] Linking dependencies...
[INFO] [4/4] Building fresh packages...
[INFO] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[ERROR] error /root/ambari/ambari-admin/src/main/resources/ui/admin-web/node_modules/phantomjs: Command failed.
[ERROR] Exit code: 1
[ERROR] Command: sh
[ERROR] Arguments: -c node install.js
[ERROR] Directory: /root/ambari/ambari-admin/src/main/resources/ui/admin-web/node_modules/phantomjs
[ERROR] Output:
[ERROR] PhantomJS not found on PATH
[ERROR] Download already available at /tmp/npm_config_tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
[ERROR] Verified checksum of previously downloaded file
[ERROR] Extracting tar contents (via spawned process)
[ERROR] Removing /root/ambari/ambari-admin/src/main/resources/ui/admin-web/node_modules/phantomjs/lib/phantom
[ERROR] Copying extracted folder /tmp/npm_config_tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1639887716005/phantomjs-2.1.1-linux-x86_64 -> /root/ambari/ambari-admin/src/main/resources/ui/admin-web/node_modules/phantomjs/lib/phantom
[ERROR] Install exited unexpectedly
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Ambari Main 2.7.6.0.0 .............................. SUCCESS [  3.717 s]
[INFO] Apache Ambari Project POM 2.7.6.0.0 ................ SUCCESS [  0.195 s]
[INFO] Ambari Web 2.7.6.0.0 ............................... SUCCESS [01:43 min]
[INFO] Ambari Views 2.7.6.0.0 ............................. SUCCESS [  6.583 s]
[INFO] Ambari Admin View 2.7.6.0.0 ........................ FAILURE [ 47.472 s]
[INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SKIPPED
[INFO] ambari-metrics 2.7.6.0.0 ........................... SKIPPED
[INFO] Ambari Metrics Common 2.7.6.0.0 .................... SKIPPED

那么將/tmp/npm_config_tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1639887716005/phantomjs-2.1.1-linux-x86_64中所有內容拷貝到 /root/ambari/ambari-admin/src/main/resources/ui/admin-web/node_modules/phantomjs/lib/phantom目錄下,重新執行即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM