yum install -y nodejs
* 安装npm
yum install -y npm
修改npm的地址为国内淘宝镜像
npm config set registry https://registry.npm.taobao.org
* 安装g++
yum install -y gcc-c++
### 2.下载安装配置启动
安装步骤保留英文原文,部分步骤添加中文解释。
#### Step 1: Download and build Ambari 2.7.7 source
1.官网指导下载方式
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.7/apache-ambari-2.7.7-src.tar.gz
实际在清华大学开源软件镜像站下载
https://mirrors.tuna.tsinghua.edu.cn/
2.解压
tar -zxvf apache-ambari-2.7.7-src.tar.gz
切换文件夹
cd apache-ambari-2.7.7-src
![在这里插入图片描述](https://img-blog.csdnimg.cn/48959b4ea0c6438fb2fa27a840d25af9.png#pic_center)
3.设置新的版本号并构建项目【云服务器用时10分钟多】
mvn versions:set -DnewVersion=2.7.7.0.0
![在这里插入图片描述](https://img-blog.csdnimg.cn/08c63aa6d1ac429299a9ff64cf3cc827.png#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/23ac614dd0b042738052bad6fd0eda02.png#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/367dce50881c41d380c8b236c8ae9722.png#pic_center)
4.切换到 ambari-metrics 目录下
pushd ambari-metrics
构建 ambari-metrics【云服务器用时不到2分钟】
mvn versions:set -DnewVersion=2.7.7.0.0
切换到原文件夹
popd
![在这里插入图片描述](https://img-blog.csdnimg.cn/3529bc77593948c887298aac1209ee48.png#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/c5d93de2f5ce4ad8b25345c33c7ba583.png#pic_center)
5.maven 打包项目【云服务器用时】一定要注意执行命令的文件夹
Re-run Maven using the -X switch to enable full debug logging.
mvn -B clean install rpm:rpm -DnewVersion=2.7.7.0.0 -DbuildNumber=388e072381e71c7755673b7743531c03a4d61be8 -DskipTests -Dpython.ver=“python >= 2.6” -X
-Drat.skip=true -Preplaceurl
![在这里插入图片描述](https://img-blog.csdnimg.cn/2808e3434fad4a739ea8f3b9eedf89e4.png#pic_center)
##### 打包项目时的问题
* 无法下载文件【从GIT下载失败 原因就不多说了】
报错详情
[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
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:install-node-and-yarn (install node and yarn) on project ambari-web: Could not download Yarn: Could not download https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz: Remote host closed connection during handshake: SSL peer shut down incorrectly -> [Help 1]
问题解决
1.自行下载安装包【浏览器直接输入文件地址即可】
https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz
2.放到对应 maven 目录中
/root/.m2/repository/com/github/eirslett/yarn/0.23.2/yarn-0.23.2./yarn-v0.23.2.tar.gz
![在这里插入图片描述](https://img-blog.csdnimg.cn/c0298ba059ef49aeb5afa1c263aa5cb6.png#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/9da91cd1760540849063dbe36aebaabb.png#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/22af2e1f7350439e8d769e8a67933b88.png#pic_center)
* 没有许可证字段
报错详情
[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…
问题解决
无需处理耐心等待后续报错
* 命令执行失败【未解决】
报错详情
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
问题解决
编辑 .bowerrc 文件
cd ambari-admin/src/main/resources/ui/admin-web
vim .bowerrc
修改后
{
# 原始
“directory”: “app/bower_components”
# 新增
,“allow_root”: true
}
删除admin-web下的node及node_modules文件夹文件
rm -rf node*
清除仓库最后更新文件
find ~/.m2/repository/ -name “*.lastUpdated” -exec rm -rf {} ;
![在这里插入图片描述](https://img-blog.csdnimg.cn/83fd42a05eec425b9fb2edf87c51d800.png#pic_center)
* 无法访问`git`仓库:遇到文件结束【未解决】
报错详情
fatal: unable to access ‘https://github.com/mochajs/mocha.git/’: Encountered end of file
关闭代理
git config --global --unset http.proxy
git config --global --unset https.proxy
* 服务器空回复【未解决】
报错详情
bower angular-translate#*
ECMDERR Failed to execute “git ls-remote --tags --heads https://github.com/PascalPrecht/bower-angular-translate.git”, exit code of #128 fatal: unable to access ‘https://github.com/PascalPrecht/bower-angular-translate.git/’: Empty reply from server
加速
git config --global http.proxy ‘socks5://127.0.0.1:7890’
git config --global https.proxy ‘socks5://127.0.0.1:7890’
问题解决
1.安装bower
npm install bower
2.在 ambari-admin/src/main/resources/ui/admin-web/ 下执行
bower install
[root@tcloud admin-web]# npm install bower
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘karma@0.12.16’,
npm WARN EBADENGINE required: { node: ‘~0.8 || ~0.10’ },
npm WARN EBADENGINE current: { node: ‘v16.18.1’, npm: ‘8.19.2’ }
npm WARN EBADENGINE }
#### Step 2: Install Ambari Server
Install the rpm package from ambari-server/target/rpm/ambari-server/RPMS/noarch/
yum install ambari-server*.rpm
#### Step 3: Setup and Start Ambari Server
Run the setup command to configure your Ambari Server, Database, JDK, LDAP, and other options:
ambari-server setup
Follow the on-screen instructions to proceed.
Once set up is done, start Ambari Server:
ambari-server start
#### Step 4: Install and Start Ambari Agent on All Hosts
**Note: This step needs to be run on all hosts that will be managed by Ambari.**
Copy the rpm package from ambari-agent/target/rpm/ambari-agent/RPMS/x86\_64/ and run:
yum install ambari-agent*.rpm
Edit /etc/ambari-agent/ambari.ini
…
[server]
hostname=localhost
…
Make sure hostname under the [server] section points to the actual Ambari Server host, rather than “localhost”.