Fork me on Gitee

Ambari2.7.6源码编译

0.编译环境和基本软件安装说明

  • cent os 7.5
  • maven 3.3.9

由于编译环境有关jar包不容易找到(storm-core-0.10.0.2.3.0.0-2557.jar、zookeeper-3.4.5.1.3.0.0-107.jar、zookeeper-3.4.6.2.3.0.0-2557.jar)。贴出ambari编译的maven repository,将该repository替换成.m2/repostiroy目录即可。

repository.tar.gz

提取码:ambari

1. 搭建http服务环境

安装过程会尝试从网络上现在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服务可加速。

yum -y install httpd
systemctl enable httpd
systemctl start httpd

安装包的下载路径如下:

将上述文件移至/var/www/html/compile-ambari目录下,需要新建compile-ambari目录

mkdir -p /var/www/html/compile-ambari
vi /etc/selinux/config
 
SELINUX=disabled

关闭防火墙、selinux

systemctl stop firewalld
systemctl dsable firewalld
setenforce 0

测试httpd访问连通性

image-20220415101059136

2. 搭建编译环境

2.1 配置Java环境

vi /etc/porfile

export JAVA_HOME=/usr/local/jdk_1.8
export PATH=$JAVA_HOME/bin:$PATH

source /etc/profile

2.2 配置Maven环境

wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

tar -zxvf apache-maven-3.3.9-bin.tar.gz -C /usr/local

mv apache-maven-3.3.9-bin maven_3.3.9
vi /etc/porfile

export MAVEN_HOME=/usr/local/maven_3.3.9
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH

source /etc/profile

maven repo切换为国内华为源

cd $MAVEN_HOME/conf
vi settings.xml

<mirror>
    <id>huaweicloud</id>
    <mirrorOf>*</mirrorOf>
    <url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>

2.3 rpm依赖下载

yum -y install rpm
yum -y install rpm-build 
yum -y install gcc-c++

2.4 python2环境检查

# 检查python版本,低于2.6的重新安装
python -V 
# 初始化python-devel
  yum install python-devel

2.5安装git

yum install git

2.6 安装python setuptools

wget https://pypi.python.org/packages/45/29/8814bf414e7cd1031e1a3c8a4169218376e284ea2553cc0822a6ea1c2d78/setuptools-36.6.0.zip

unzip setuptools-36.6.0.zip
cd setuptools-36.6.0
python setup.py install

3.下载Ambari源码

下载ambari源码

wget https://repo.huaweicloud.com/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

修改ambari-metrics/pom.xml文件,将habse、hadoop、phoenix和grafana的下载路径进行替换。

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

执行编译命令

mvn -B clean install package rpm:rpm -DnewVersion=2.7.6.0.0 -DskipTests -Drat.skip -Dpython.ver="python >= 2.7" -Preplaceurl 

-e 参数可以打印具体编译过程报错信息

可以得到

image-20220415172400239

4.相关问题及解决

无法访问org.json.simple.JSONAware

在ambari-metrics-storm-sink-legacy中pom.xml中添加依赖。

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

卡在 [INFO] Downloading https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz to /root/.m2/repository/com/github/eirslett/yarn/0.23.2/yarn-0.23.2./yarn-v0.23.2.tar.gz

连接到github并下载yarn-v0.23.2.tar.gz,放到对应maven目录中


[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]

连接github下载node_modules无法连接,建议在网络情况好的时候,重新编译。


[ERROR] error /root/apache-ambari-2.7.6-src/ambari-web/node_modules/phantomjs-prebuilt: Command failed.
[ERROR] Exit code: 1
[ERROR] Command: sh
[ERROR] Arguments: -c node install.js
[ERROR] Directory: /root/apache-ambari-2.7.6-src/ambari-web/node_modules/phantomjs-prebuilt
[ERROR] Output:
[ERROR] PhantomJS not found on PATH
[ERROR] Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
[ERROR] Saving to /tmp/npm_config_tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
[ERROR] Receiving...
[ERROR]
[ERROR] Error making request.
[ERROR] Error: socket hang up
[ERROR]     at TLSSocket.onHangUp (_tls_wrap.js:1054:19)
[ERROR]     at TLSSocket.g (events.js:260:16)
[ERROR]     at emitNone (events.js:72:20)
[ERROR]     at TLSSocket.emit (events.js:166:7)
[ERROR]     at endReadableNT (_stream_readable.js:921:12)
[ERROR]     at nextTickCallbackWith2Args (node.js:442:9)
[ERROR]     at process._tickCallback (node.js:356:17)
[ERROR]
[ERROR] Please report this full log at https://github.com/Medium/phantomjs

连接github去下载phantomjs-2.1.1-linux-x86_64.tar.bz2失败,需要手动去将phantomjs-2.1.1-linux-x86_64.tar.bz2下载到/tmp/npm_config_tmp/phantomjs/目录下

cd /tmp/npm_config_tmp/phantomjs/
wget https://npm.taobao.org/mirrors/phantomjs//phantomjs-2.1.1-linux-x86_64.tar.bz2

参考博客

posted @ 2022-04-15 15:37  shine-rainbow  阅读(2056)  评论(7编辑  收藏  举报