我安装所使用的系统是CentOS6,也可以是red5、6都可以。Bigtop官方网上有Ubuntu系统安装的具体过程。
1. 安装系统依赖
1.1 系统更新并安装新的包
Building Bigtop requires the following tools:
· Java JDK 1.6
· Apache Ant(可以通过yum安装)
· Apache Maven
· wget
· tar
· git
· subversion
· gcc
· gcc-c++
· make
· fuse
· protobuf-compiler(yum无法安装通过定制安装)
· autoconf
· automake
· libtool
· sharutils
· asciidoc
· xmlto
On RPM-based systems one also needs
· lzo-devel
· zlib-devel
· fuse-devel
· openssl-devel
· python-devel
· libxml2-devel
· libxslt-devel
· cyrus-sasl-devel
· sqlite-devel
· mysql-devel
· openldap-devel
· rpm-build
· createrepo
· redhat-rpm-config(RedHat/CentOS only)
以上具体依赖包请参考官方网站(http://bigtop.apache.org/)。
1.2 安装Sun JDK 6
cd /opt
chmod +x jdk-6u31-linux-x64.bin
./ jdk-6u31-linux-x64.bin
1.3 安装Maven3
wget
http://apache.petsads.us/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
tar -xzvf apache-maven-3.0.5-bin.tar.gz
1.4安装Apache Forrest
cd /opt wgethttp://archive.apache.org/dist/forrest/0.9/apache-forrest-0.9.tar.gz tar -xzvf /home/ubuntu/Downloads/apache-forrest-0.9.tar.gz # modify certain lines in the forrest-validate xml, otherwise buildfails. either sed or nano are fine. sed -i ‘s/propertyname="forrest.validate.sitemap"value="${forrest.validate}"/propertyname="forrest.validate.sitemap" value="false"/g‘apache-forrest-0.9/main/targets/validate.xml sed -i ‘s/propertyname="forrest.validate.stylesheets"value="${forrest.validate}"/propertyname="forrest.validate.stylesheets" value="false"/g‘apache-forrest-0.9/main/targets/validate.xml sed -i ‘s/propertyname="forrest.validate.stylesheets.failonerror"value="${forrest.validate.failonerror}"/propertyname="forrest.validate.stylesheets.failonerror"value="false"/g‘ apache-forrest-0.9/main/targets/validate.xml sed -i ‘s/property name="forrest.validate.skins.stylesheets"value="${forrest.validate.skins}"/propertyname="forrest.validate.skins.stylesheets" value="false"/g‘apache-forrest-0.9/main/targets/validate.xml
1.5安装protobuf
protobuf版本至少需要2.4.0,具体版本视hadoop版本而定,例如hadoop-2.4.0即需要依赖protobuf-2.5.0
到 Protocol Buffers 的官网https://code.google.com/p/protobuf/下载2.5.0的安装源文件进行安装:
tar -zxf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure --prefix=/usr/local/protobuf
make check
make install
安装完成后,执行 protoc --vresion 验证是否安装成功。
2. 设置环境变量
在/etc/profile文件中添加以下内容:
vi /etc/profile
export JAVA_HOME=/opt/jdk1.6.0_31
export JRE_HOME=/opt/jdk1.6.0_31/jre
export MAVEN_HOME=/opt/apache-maven-3.0.5
export FORREST_HOME=/opt/apache-forrest-0.8
exportCLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
exportPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$MAVEN_HOME/bin:$FORREST_HOME/bin
source /etc/profile
3. 下载并编译源代码
git clone git://git.apache.org/bigtop.git
# put files under bigtop directory
cd bigtop
# you can also use a different branch, e.g.git checkout branch-0.7
为了加快编译速度,你可以修改Makefile文件中的APACHE_MIRROR和APACHE_ARCHIVE为国内的速度较快的apache镜像地址,例如:http://mirror.bit.edu.cn/apache
编译源代码:
./check-env.sh # make sure all the requiredenvironment variables are set
make realclean
make bigtop-utils-rpm # build this projectfirst
make bigtop-jsvc-rpm
make bigtop-tomcat-rpm
make hadoop-rpm # to build just for hadoopfirst
make rpm # build all the rest
编译之后deb输出在output目录
4. 安装和测试
在使用dpkg命令安装之前,先关掉自动启动服务。使用root用欢创建/usr/sbin/policy-rc.d,该文件内容如下:
#!/bin/sh
exit 101
添加执行权限:
sudo chmod +x /usr/sbin/policy-rc.d
安装deb文件:
cd output/bigtop-utils
sudo dpkg --install *.deb
cd ..
sudo dpkg --install **/**.deb
最后别忘了删除掉policy-rc.d:
sudo rm /usr/sbin/policy-rc.d
初始化hdfs:
sudo -u hdfs hadoop namenode -format
启动服务:
sudo /etc/init.d/hadoop-hdfs-namenode start
sudo /etc/init.d/hadoop-hdfs-datanode start
#sudo /etc/init.d/hadoop-xxxx start
接下来可以查看日志和web页面是否正常了。访问http://localhost:50070/,你就可以看到hadoop-2.3.0的小清新的管理界面了。
5. 排错
1) bigtop-0.7依赖的是protobuf-2.4.0而不是protobuf-2.5.0,导致编译过程出现protobuf的版本需要2.5.0的提示,请卸载2.4.0版本重新编译protobuf-2.5.0。
2) 运行make deb时出现more change dataor trailer的异常(详细异常信息见下面),请将操作系统的LANG修改为en_US
parsechangelog/debian: warning: debian/changelog(l4): badly formattedtrailer line
LINE: -- Bigtop <[email protected]> 四, 17 4月 2014 14:30:17 +0800
parsechangelog/debian: warning: debian/changelog(l4): found eof whereexpected more change data or trailer
dpkg-buildpackage: source package zookeeper
dpkg-buildpackage: source version 3.4.5-1
dpkg-buildpackage: error: unable todetermine source changed by
通过Bigtop编译Hadoop组件的rpm包