1. 系统准备
本次操作均在centos7 docker下安装完成,首先我们获取一个全新的centos7
由于安装过程中,maven下载的引用包,国内有些资源无法下载,方便出国,使用 --network host 参数启动,与宿主机使用同一网络
shell
docker pull centos:centos7
docker run --name centos7 --network host -itd centos:centos7
1
2
2
2. 环境准备
Docker Centos7中,后续编译均在容器中完成
安装 JDK、Maven、以及其他的依赖库
shell
wget jdk-8u291-linux-x64.tar.gz
wget apache-maven-3.8.1-bin.tar.gz
vim /etc/profile
export JAVA_HOME="/home/jdk1.8.0_291"
export PATH="${JAVA_HOME}/bin:$PATH"
export MAVEN_HOME="/home/apache-maven-3.8.1"
export PATH="${MAVEN_HOME}/bin:$PATH"
source /etc/profile
yum install vim -y
yum install wget -y
yum install epel-release -y
yum install rpm-build -y
yum install gcc-c++ -y
yum install git -y
yum install python-devel.x86_64 -y
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
sh setuptools-0.6c11-py2.7.egg
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
yum install nodejs -y
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
yum install yarn -y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
3. 下载 Apache-Ambari-2.7.6
shell
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.6/apache-ambari-2.7.6-src.tar.gz
tar xfvz apache-ambari-2.7.6-src.tar.gz
cd apache-ambari-2.7.6-src
mvn versions:set -DnewVersion=2.7.6.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.6.0.0
popd
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
4. 调整 Apache-Ambari-2.7.6
后续编译的时候,发现无法完整下载到对应的 phoenix-core 版本 5.0.0-HBase-2.0,后来发现存在 javax.el 下载不到,所以单独引入固定版本,如果你的引用没问题,可以不改
-- 字体为新增部分 vim apache-ambari-2.7.6-src/ambari-metrics/ambari-metrics-timelineservice/pom.xml
xml
<phoenix.version>5.0.0-HBase-2.0</phoenix.version>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>${phoenix.version}</version>
<!-- 添加如下排除 -->
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
</dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>${phoenix.version}</version>
<scope>test</scope>
<!-- 添加如下排除 -->
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
</dependency>
<!-- 添加如下依赖 -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
</dependency>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
5. 编译 Apache-Ambari-2.7.6
-Drat.skip=true 添加该参数跳过rat检查(error: too many files are open)
shell
mvn -B install rpm:rpm -DnewVersion=2.7.6.0.0 -DbuildNumber=388e072381e71c7755673b7743531c03a4d61be8 -Drat.skip=true -DskipTests -Dpython.ver="python >= 2.6"
1
编译过程如果网络不好,下载不到对应相关依赖导致失败,需要从失败位置继续编译
shell
find ~/.m2/repository/ -name "*.lastUpdated" -exec rm -rf {} \;
1
编译成功
看到 BUILD SUCCESS 意味着编译成功。
[INFO] Building target platforms: noarch-redhat-linux
[INFO] Building for target noarch-redhat-linux
[INFO] Processing files: ambari-infra-manager-it-2.7.6.0-0.noarch
[INFO] Provides: ambari-infra-manager-it = 2.7.6.0-0
[INFO] Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
[INFO] Checking for unpackaged file(s): /usr/lib/rpm/check-files /mnt/build_work/apache-ambari-2.7.6-src/ambari-infra/ambari-infra-manager-it/target/rpm/ambari-infra-manager-it/buildroot
[INFO] Wrote: /mnt/build_work/apache-ambari-2.7.6-src/ambari-infra/ambari-infra-manager-it/target/rpm/ambari-infra-manager-it/RPMS/noarch/ambari-infra-manager-it-2.7.6.0-0.noarch.rpm
[INFO] Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.QyHgdN
[INFO] + umask 022
[INFO] + cd /mnt/build_work/apache-ambari-2.7.6-src/ambari-infra/ambari-infra-manager-it/target/rpm/ambari-infra-manager-it/BUILD
[INFO] + /usr/bin/rm -rf /mnt/build_work/apache-ambari-2.7.6-src/ambari-infra/ambari-infra-manager-it/target/rpm/ambari-infra-manager-it/buildroot
[INFO] + exit 0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Ambari Main 2.7.6.0.0 .............................. SUCCESS [ 6.673 s]
[INFO] Apache Ambari Project POM 2.7.6.0.0 ................ SUCCESS [ 0.476 s]
[INFO] Ambari Web 2.7.6.0.0 ............................... SUCCESS [02:12 min]
[INFO] Ambari Views 2.7.6.0.0 ............................. SUCCESS [ 4.700 s]
[INFO] Ambari Admin View 2.7.6.0.0 ........................ SUCCESS [01:14 min]
[INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SUCCESS [ 5.933 s]
[INFO] ambari-metrics 2.7.6.0.0 ........................... SUCCESS [ 1.599 s]
[INFO] Ambari Metrics Common 2.7.6.0.0 .................... SUCCESS [ 11.101 s]
[INFO] Ambari Metrics Hadoop Sink 2.7.6.0.0 ............... SUCCESS [ 50.086 s]
[INFO] Ambari Metrics Flume Sink 2.7.6.0.0 ................ SUCCESS [ 27.701 s]
[INFO] Ambari Metrics Kafka Sink 2.7.6.0.0 ................ SUCCESS [ 29.690 s]
[INFO] Ambari Metrics Storm Sink 2.7.6.0.0 ................ SUCCESS [ 4.284 s]
[INFO] Ambari Metrics Storm Sink (Legacy) 2.7.6.0.0 ....... SUCCESS [ 4.833 s]
[INFO] Ambari Metrics Collector 2.7.6.0.0 ................. SUCCESS [15:16 min]
[INFO] Ambari Metrics Monitor 2.7.6.0.0 ................... SUCCESS [ 2.057 s]
[INFO] Ambari Metrics Grafana 2.7.6.0.0 ................... SUCCESS [ 56.676 s]
[INFO] Ambari Metrics Host Aggregator 2.7.6.0.0 ........... SUCCESS [06:59 min]
[INFO] Ambari Metrics Assembly 2.7.6.0.0 .................. SUCCESS [19:42 min]
[INFO] Ambari Service Advisor 1.0.0.0-SNAPSHOT ............ SUCCESS [ 1.812 s]
[INFO] Ambari Server 2.7.6.0.0 ............................ SUCCESS [24:56 min]
[INFO] Ambari Functional Tests 2.7.6.0.0 .................. SUCCESS [ 4.103 s]
[INFO] Ambari Agent 2.7.6.0.0 ............................. SUCCESS [07:20 min]
[INFO] ambari-logsearch 2.7.6.0.0 ......................... SUCCESS [ 1.089 s]
[INFO] Ambari Logsearch Appender 2.7.6.0.0 ................ SUCCESS [ 1.792 s]
[INFO] Ambari Logsearch Config Api 2.7.6.0.0 .............. SUCCESS [ 1.519 s]
[INFO] Ambari Logsearch Config JSON 2.7.6.0.0 ............. SUCCESS [ 1.131 s]
[INFO] Ambari Logsearch Config Solr 2.7.6.0.0 ............. SUCCESS [ 0.970 s]
[INFO] Ambari Logsearch Config Zookeeper 2.7.6.0.0 ........ SUCCESS [ 0.902 s]
[INFO] Ambari Logsearch Config Local 2.7.6.0.0 ............ SUCCESS [ 0.961 s]
[INFO] Ambari Logsearch Log Feeder Plugin Api 2.7.6.0.0 ... SUCCESS [ 1.559 s]
[INFO] Ambari Logsearch Log Feeder Container Registry 2.7.6.0.0 SUCCESS [ 2.177 s]
[INFO] Ambari Logsearch Log Feeder 2.7.6.0.0 .............. SUCCESS [ 18.507 s]
[INFO] Ambari Logsearch Web 2.7.6.0.0 ..................... SUCCESS [01:22 min]
[INFO] Ambari Logsearch Server 2.7.6.0.0 .................. SUCCESS [01:26 min]
[INFO] Ambari Logsearch Assembly 2.7.6.0.0 ................ SUCCESS [ 2.008 s]
[INFO] Ambari Logsearch Integration Test 2.7.6.0.0 ........ SUCCESS [ 37.542 s]
[INFO] ambari-infra 2.7.6.0.0 ............................. SUCCESS [ 0.529 s]
[INFO] Ambari Infra Solr Client 2.7.6.0.0 ................. SUCCESS [10:42 min]
[INFO] Ambari Infra Solr Plugin 2.7.6.0.0 ................. SUCCESS [ 18.577 s]
[INFO] Ambari Infra Manager 2.7.6.0.0 ..................... SUCCESS [01:44 min]
[INFO] Ambari Infra Assembly 2.7.6.0.0 .................... SUCCESS [ 3.853 s]
[INFO] Ambari Infra Manager Integration Tests 2.7.6.0.0 ... SUCCESS [03:16 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:41 h
[INFO] Finished at: 2022-03-24T09:36:06Z
[INFO] ------------------------------------------------------------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
6. 编译过程的坑
- 编译 Yarn 的一些依赖可能无法下载。
Yarn 淘宝源安装,分别复制粘贴以下代码行到黑窗口运行即可
shell
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
1
2
2
- PhantomJS 无法下载
编译过程,反复出现:
shell
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/**/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
1
2
3
4
2
3
4
自行 copy phantomjs-2.1.1-linux-x86_64.tar.bz2 到 Saving to 的 Dir,再次执行 mvn 全局编译。
可到如下站点下载: