ambari的编译

此次编译用VM14虚拟机安装Centos7系统进行编译,其中作者发现有docker脚本虽然可以添加镜像编译环境但是操作较复杂问题多变所以没能完整编译代码,退而求其次在虚拟机上搭建了整体编译环境方便编译与后期开发。

编译环境

  • JDK 8(Ambari 2.6及以下可以用JDK 7编译,从Ambari 2.7开始,至少可以用JDK 8编译)
  • Apache Maven 3.3.9 或更高版本
  • Python 2.7(Ambari 2.7 或更高版本需要 Python 2.7 作为最低支持版本)
  • NodeJS 16.15.1(16.15.1为当前稳定版本,主要解决ambari-admin的编译中bower的问题)
  • 系统环境Centos7.5
yum -y install gcc-c++ git psutils python-devel rpm-build 

编译环境验证

  • JDK8
[root@localhost opt]# java  -version
java version "1.8.0_333"
Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.333-b02, mixed mode)
  • Maven
    添加maven源
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>https://repo1.maven.org/maven2 </url>
      <blocked>true</blocked>
    </mirror>
  • 查看maven安装情况
[root@localhost ~]# mvn -version
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /opt/maven-3.8.5
Java version: 1.8.0_333, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_333-amd64/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1160.el7.x86_64", arch: "amd64", family: "unix"
  • Python2.7(系统默认)
[root@localhost ~]# python --version
Python 2.7.5
  • NodeJS
[root@localhost opt]# node -v
v16.15.1
[root@localhost opt]# npm -v
8.11.0
  • 系统环境centos7
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
  • 系统编译环境
[root@localhost ~]# yum -y install gcc-c++ git psutils python-devel rpm-build 
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.bfsu.edu.cn
软件包 gcc-c++-4.8.5-44.el7.x86_64 已安装并且是最新版本
软件包 git-1.8.3.1-23.el7_8.x86_64 已安装并且是最新版本
软件包 psutils-1.17-44.el7.x86_64 已安装并且是最新版本
软件包 python-devel-2.7.5-90.el7.x86_64 已安装并且是最新版本
软件包 rpm-build-4.11.3-48.el7_9.x86_64 已安装并且是最新版本
无须任何处理
  • 优先编译
    优先编译是为了解决admin-admin中的bower组件的问题为了在后续编译一次通过所以提前编译
cd /opt/ambari-2.7.6/ambari-admin/src/main/resources/ui/admin-web

编辑.bowerrc

#允许以root用户执行bower命令。 添加"allow_root": true ,不要忘记逗号
#也可以在执行命令的时候通过参数设定 如:bower install --allow-root    不要复制这段注释
{
	    "directory": "app/bower_components",
	    "allow_root": true 
}

安装bower的依赖环境
安装npm依赖包,全局安装gulp、bower

npm install
npm install -g bower
npm install -g gulp

安装bower的依赖包

bower install

如果出现问题请移步ambari全攻略流程,错问杂集ambari(零)-编译admin-admin问题

  • 执行全部编译
    反回源码根目录执行全部编译
mvn -B -e clean install package rpm:rpm -DnewVersion=2.7.6.0.0 -DskipTests -Dpython.ver="python >= 2.7" -Preplaceurl

如果出现问题请移步ambari全攻略流程,错问杂集ambari(零)-整体编译问题

  • 如果问题都处理了恭喜了编译完成
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Ambari Main 2.7.6.0.0 .............................. SUCCESS [  6.933 s]
[INFO] Apache Ambari Project POM 2.7.6.0.0 ................ SUCCESS [  0.181 s]
[INFO] Ambari Web 2.7.6.0.0 ............................... SUCCESS [ 50.400 s]
[INFO] Ambari Views 2.7.6.0.0 ............................. SUCCESS [  1.199 s]
[INFO] Ambari Admin View 2.7.6.0.0 ........................ SUCCESS [ 25.994 s]
[INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SUCCESS [  2.346 s]
[INFO] ambari-metrics 2.7.6.0.0 ........................... SUCCESS [  1.301 s]
[INFO] Ambari Metrics Common 2.7.6.0.0 .................... SUCCESS [  5.334 s]
[INFO] Ambari Metrics Hadoop Sink 2.7.6.0.0 ............... SUCCESS [  2.725 s]
[INFO] Ambari Metrics Flume Sink 2.7.6.0.0 ................ SUCCESS [  1.518 s]
[INFO] Ambari Metrics Kafka Sink 2.7.6.0.0 ................ SUCCESS [  1.881 s]
[INFO] Ambari Metrics Storm Sink 2.7.6.0.0 ................ SUCCESS [  1.985 s]
[INFO] Ambari Metrics Storm Sink (Legacy) 2.7.6.0.0 ....... SUCCESS [  1.845 s]
[INFO] Ambari Metrics Collector 2.7.6.0.0 ................. SUCCESS [05:49 min]
[INFO] Ambari Metrics Monitor 2.7.6.0.0 ................... SUCCESS [  1.031 s]
[INFO] Ambari Metrics Grafana 2.7.6.0.0 ................... SUCCESS [01:46 min]
[INFO] Ambari Metrics Host Aggregator 2.7.6.0.0 ........... SUCCESS [  5.642 s]
[INFO] Ambari Metrics Assembly 2.7.6.0.0 .................. SUCCESS [02:23 min]
[INFO] Ambari Service Advisor 1.0.0.0-SNAPSHOT ............ SUCCESS [  0.406 s]
[INFO] Ambari Server 2.7.6.0.0 ............................ SUCCESS [04:37 min]
[INFO] Ambari Functional Tests 2.7.6.0.0 .................. SUCCESS [  0.713 s]
[INFO] Ambari Agent 2.7.6.0.0 ............................. SUCCESS [ 57.253 s]
[INFO] ambari-logsearch 2.7.6.0.0 ......................... SUCCESS [  1.624 s]
[INFO] Ambari Logsearch Appender 2.7.6.0.0 ................ SUCCESS [  0.310 s]
[INFO] Ambari Logsearch Config Api 2.7.6.0.0 .............. SUCCESS [  0.225 s]
[INFO] Ambari Logsearch Config JSON 2.7.6.0.0 ............. SUCCESS [  0.196 s]
[INFO] Ambari Logsearch Config Solr 2.7.6.0.0 ............. SUCCESS [  0.230 s]
[INFO] Ambari Logsearch Config Zookeeper 2.7.6.0.0 ........ SUCCESS [  0.217 s]
[INFO] Ambari Logsearch Config Local 2.7.6.0.0 ............ SUCCESS [  0.181 s]
[INFO] Ambari Logsearch Log Feeder Plugin Api 2.7.6.0.0 ... SUCCESS [  0.204 s]
[INFO] Ambari Logsearch Log Feeder Container Registry 2.7.6.0.0 SUCCESS [  0.383 s]
[INFO] Ambari Logsearch Log Feeder 2.7.6.0.0 .............. SUCCESS [  3.706 s]
[INFO] Ambari Logsearch Web 2.7.6.0.0 ..................... SUCCESS [02:10 min]
[INFO] Ambari Logsearch Server 2.7.6.0.0 .................. SUCCESS [02:50 min]
[INFO] Ambari Logsearch Assembly 2.7.6.0.0 ................ SUCCESS [  1.036 s]
[INFO] Ambari Logsearch Integration Test 2.7.6.0.0 ........ SUCCESS [02:06 min]
[INFO] ambari-infra 2.7.6.0.0 ............................. SUCCESS [  6.631 s]
[INFO] Ambari Infra Solr Client 2.7.6.0.0 ................. SUCCESS [  5.720 s]
[INFO] Ambari Infra Solr Plugin 2.7.6.0.0 ................. SUCCESS [  8.742 s]
[INFO] Ambari Infra Manager 2.7.6.0.0 ..................... SUCCESS [01:19 min]
[INFO] Ambari Infra Assembly 2.7.6.0.0 .................... SUCCESS [  0.801 s]
[INFO] Ambari Infra Manager Integration Tests 2.7.6.0.0 ... SUCCESS [ 58.885 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27:22 min
[INFO] Finished at: 2022-06-17T19:20:57+08:00
[INFO] ------------------------------------------------------------------------
在编译完成后我们可以进入下一步开发ambari全攻略流程,开发ambari(四)

如果有问题和建议可以评论私信,欢迎点赞收藏转发

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐