输入命令
[root@bigData-02 ~]# Java –version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
如果出现以上数据,表明已经安装成功jdk。如果没有安装,使用yum安装jdk。
[root@bigData-02 ~]# yum install jdk
[root@bigData-02 ~]# wget http://apache.fayea.com/apache-mirror/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
[root@bigData-02 ~]# tar -zxvf apache-maven-3.0.5-bin.tar.gz
[root@bigData-02 ~]# vi /etc/profile
export MAVEN_HOME="/usr/local/apache-maven-3.0.5"
export path=$path: $MAVEN_HOME/bin
[root@bigData-02 ~]#source /etc/profile
4)检查是否安装成功
[root@bigData-02 ~]# mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/local/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.el6.x86_64", arch: "amd64", family: "unix"
[root@bigData-02 ~]# Python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
表明当前版本是2.6.6
如果不是2.6.6版本,可以下载相应版本执行安装
[root@bigData-02 ~]# wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
[root@bigData-02 ~]# sh setuptools-0.6c11-py2.6.egg
最后再输入第一步命令,检测版本号。
1)检测rpm-build是否已经安装
[root@bigData-02 ~]# rpm -qa | grep rpm-build
2)安装
[root@bigData-02 ~]# yum install rpm-build
[root@bigData-02 ~]# rpm -qa | grep gcc-c++
[root@bigData-02 ~]# yum install gcc-c++
[root@bigData-02 ~]# wget http://nodejs.org/dist/v0.10.33/node-v0.10.33-linux-x64.tar.gz
[root@bigData-02 ~]# tar –zxvf node-v0.10.33-linux-x64.tar.gz
[root@bigData-02 ~]# vi /etc/profile
export NODE_HOME="/node/node-v0.10.33-linux-x64/"
export path=$path: $NODE_HOME/bin
[root@bigData-02 ~]#source /etc/profile
[root@bigData-02 ~]# node -v
v0.10.33
[root@bigData-02 ~]# npm -v
1.4.28
1)安装
[root@bigData-02 ~]# npm install -g brunch
[root@bigData-02 ~]# brunch
Usage: brunch [command] [options]
Commands:
new [skeleton] [path] Create new brunch project in path [.]. Short-cut: n
build [options] Build a brunch project. Short-cut: b
watch [options] Watch brunch directory and rebuild if something changed. Short-cut: w
Options:
-h, --help output usage information
-V, --version output the version number
[root@bigData-02 ~]# Git –version
[root@bigData-02 ~]# yum install git
Ambari的代码托管在github中,可以在linux上安装git软件,方便获取源代码。也可以通过web访问github的主页,搜索ambari项目,下载相应的版本。此处我们选择稳定版本1.6.1版本。
下载地址:
https://github.com/apache/ambari/archive/release-1.6.1.zip
解压之后上传到linux服务器上。
进入到ambari的主目录中,执行mvn编译命令。
[root@bigData-02 ~]# mvn versions:set -DnewVersion=1.6.1.1
注意此处的版本号需要是四位数字,下载的版本是1.6.1,此处我们在后面加上一个自己的版本,所以定为1.6.1.1
[INFO] Ambari Main ....................................... SUCCESS [1.415s]
[INFO] Apache Ambari Project POM ......................... SKIPPED
[INFO] Ambari Web ........................................ SKIPPED
[INFO] Ambari Views ...................................... SKIPPED
[INFO] Ambari Admin View ................................. SKIPPED
[INFO] Ambari Server ..................................... SKIPPED
[INFO] Ambari Agent ...................................... SKIPPED
[INFO] Ambari Client ..................................... SKIPPED
[INFO] Ambari Python Client .............................. SKIPPED
[INFO] Ambari Groovy Client .............................. SKIPPED
[INFO] Ambari Shell ...................................... SKIPPED
[INFO] Ambari Python Shell ............................... SKIPPED
[INFO] Ambari Groovy Shell ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.592s
[INFO] Finished at: Wed Dec 03 14:13:44 CST 2014
[INFO] Final Memory: 15M/211M
[root@bigData-02 ambari]# mvn -B clean install package rpm:rpm -DnewVersion=1.6.1.1 -DskipTests -Dpython.ver="python >= 2.6" -Preplaceurl
[INFO] Ambari Main ....................................... SUCCESS [14.721s]
[INFO] Apache Ambari Project POM ......................... SUCCESS [1.160s]
[INFO] Ambari Web ........................................ SUCCESS [48.102s]
[INFO] Ambari Views ...................................... SUCCESS [13.944s]
[INFO] Ambari Admin View ................................. SUCCESS [44.792s]
[INFO] Ambari Server ..................................... SUCCESS [6:25.135s]
[INFO] Ambari Agent ...................................... SUCCESS [19.533s]
[INFO] Ambari Client ..................................... SUCCESS [0.239s]
[INFO] Ambari Python Client .............................. SUCCESS [2.208s]
[INFO] Ambari Groovy Client .............................. SUCCESS [6.670s]
[INFO] Ambari Shell ...................................... SUCCESS [0.699s]
[INFO] Ambari Python Shell ............................... SUCCESS [1.339s]
[INFO] Ambari Groovy Shell ............................... SUCCESS [5.103s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
自此编译成功。
编译技巧:
1)需要注意的是此处maven编译大约要下载258M左右的依赖,在网络不好的情况下经常会出现time out的异常,并且需要反复编译,特别耗时,第一次编译大概花了一天时间,因此编译的时候可以对project进行逐个编译,节约时间。
2)项目中需要使用nodejs中的npm管理依赖,有些依赖特别难下载,下载好之后会存放在ambari-web/node_modules中,在下次编译的时候可以对ambari-web/node_modules备份,下次编译的时候,可以先对项目进行mvn clean删除,然后再将备份的node_modules拷入项目中,重新执行mvn install操作,可以节省很多时间。
Ambari安装需要ambari-server安装到管理机上,ambari-agent安装到集群节点上。
Ambari-server的rpm包
ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server-*.noarch.rpm
Ambari-agent的rpm包
ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-*.rpm
转自:http://blog.csdn.net/shifenglov/article/details/42190827