Ubuntu系统编译Bigtop

本文详细介绍如何从零开始搭建Hadoop环境,包括系统依赖安装、环境变量配置、源代码编译及测试等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 安装系统依赖

系统更新并安装新的包

sudo apt-get update

sudo apt-get install -y cmake git-core git-svn subversion checkinstall build-essential dh-make debhelper ant ant-optional autoconf automake liblzo2-dev libzip-dev sharutils libfuse-dev reprepro libtool libssl-dev asciidoc xmlto ssh curl

sudo apt-get install -y devscripts

sudo apt-get build-dep pkg-config

安装Sun JDK 6或OpenJDK 7

Sun JDK 6:

执行以下脚本:

wget http://archive.cloudera.com/cm4/ubuntu/precise/amd64/cm/pool/contrib/o/oracle-j2sdk1.6/oracle-j2sdk1.6_1.6.0+update31_amd64.deb
dpkg -i oracle-j2sdk1.6_1.6.0+update31_amd64.deb

sudo rm /usr/lib/jvm/default-java
sudo ln -s /usr/lib/jvm/j2sdk1.6-oracle /usr/lib/jvm/default-java
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/default-java/bin/java 5
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/default-java/bin/javac 5
sudo update-alternatives --set java /usr/lib/jvm/default-java/bin/java

OpenJDK 7:

OpenJDK 6 fails to build Hadoop because of issue MAPREDUCE-4115 Need to use OpenJDK 7

sudo apt-get install openjdk-7-jdk
sudo rm /usr/lib/jvm/default-java
sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/default-java
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/default-java/bin/java 5
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/default-java/bin/javac 5
sudo update-alternatives --set java /usr/lib/jvm/default-java/bin/java

安装Maven 3

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

sudo mkdir /usr/local/maven-3
sudo mv apache-maven-3.0.5 /usr/local/maven-3/

安装Apache Forrest

cd $HOME
wget http://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 build fails. either sed or nano are fine.
sed -i 's/property name="forrest.validate.sitemap" value="${forrest.validate}"/property name="forrest.validate.sitemap" value="false"/g' apache-forrest-0.9/main/targets/validate.xml
sed -i 's/property name="forrest.validate.stylesheets" value="${forrest.validate}"/property name="forrest.validate.stylesheets" value="false"/g' apache-forrest-0.9/main/targets/validate.xml
sed -i 's/property name="forrest.validate.stylesheets.failonerror" value="${forrest.validate.failonerror}"/property name="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}"/property name="forrest.validate.skins.stylesheets" value="false"/g' apache-forrest-0.9/main/targets/validate.xml

安装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.d/bigtop.sh并添加如下内容:

export JAVA_HOME="/usr/lib/jvm/default-java"
export JAVA5_HOME="/usr/lib/jvm/default-java"
export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=512m"
export MAVEN_HOME="/usr/local/maven-3/apache-maven-3.0.5"
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$MAVEN_HOME/bin"

FORREST_HOME添加到~/.bashrc:

export FORREST_HOME="$HOME/apache-forrest-0.9"

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_MIRRORAPACHE_ARCHIVE为国内的速度较快的apache镜像地址,例如:http://mirror.bit.edu.cn/apache

编译源代码:

./check-env.sh # make sure all the required environment variables are set
make realclean
make bigtop-utils-deb # build this project first
make bigtop-jsvc-deb
make bigtop-tomcat-deb
make hadoop-deb # to build just for hadoop first
make deb # 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 data or trailer的异常(详细异常信息见下面),请将操作系统的LANG修改为en_US

parsechangelog/debian: warning:     debian/changelog(l4): badly formatted trailer line
LINE:  -- Bigtop <dev@bigtop.apache.org>  四, 17 4月 2014 14:30:17 +0800
parsechangelog/debian: warning:     debian/changelog(l4): found eof where expected more change data or trailer
dpkg-buildpackage: source package zookeeper
dpkg-buildpackage: source version 3.4.5-1
dpkg-buildpackage: error: unable to determine source changed by
FinalBIG BIG文件编辑器 FinalBIG Version 0.4 Beta released March 20th, 2006. Copyright by Matthias Wagner 2006 C&C Generals is a trademark or registered trademark of Electronic Arts in the USA and/or other countries. All rights reserved. The Lord of the Rings(tm), The Battle for Middle-earth(tm) is a trademark or registered trademark of Electronic Arts in the USA and/or other countries. All rights reserved. LucasArts, the LucasArts logo, STAR WARS and related properties are trademarks in the United States and/or in other countries of Lucasfilm Ltd. and/or its affiliates. (c) 2006 Lucasfilm Entertainment Company Ltd. or Lucasfilm Ltd. All rights reserved. This software is based in part on the work of the Independent JPEG Group ----------- Information ----------- FinalBIG is a viewer and editor for the BIG files of C&C Generals and Lord of the Rings: Battle for Middle Earth. It can also open and save the MEG files of Star Wars(TM): Empire at War(TM). I tried to make it as easy to use as possible. ------- Contact ------- Suggestions? Questions? Mail: webmaster *at* wagnerma.de Website: http://www.wagnerma.de ------- Credits ------- Thanks to Jonathan Wilson for W3D help Thanks to Deezire for his Module list Thanks to Waraddict for adding modules Uses CRC code available at http://www.zorc.breitbandkatze.de/crc.html Uses MEG file information found here: http://alpha1.dyns.net/eaw/MegFileFormat, http://www.technical-difficulties.com/ ------- License ------- FinalBIG is freeware and is provided "as-is". Use at your own risk. No reverse engineering allowed. Editing finalbig.ini welcome. Please don't mirror FinalBIG without asking me. -------------------- System Requirements -------------------- - OpenGL drivers installed - DirectX 9.0c installed (for DX9 version) - Tested on WinXP only ---------- HOW TO USE ---------- Actually FinalBIG is very easy to use, especially if you are used to other packaging & compression programs. You can use FinalBIG to distribute your modifications to Generals and LOTR:BFME. To open a BIG file, just click on File->Open and select your BIG file. You can now browse the files included in this BIG file. However, you can also edit it. You can do this either by using the Edit menu, or you can drag & drop files from Windows Explorer into FinalBIG. Just drop the files (or directories!) on the file list of your BIG file. A window will come up telling you that FinalBIG needs to activate EditMode. Accept that, but you really should back up any original BIG files before saving. That磗 it! Now save your work, and you are done! It works exactly the same way for MEG files. ---------- W3D Viewer ---------- The W3D viewer should display almost all W3Ds fine. If you want to rotate the model, press the NumKeys (at the right of your keyboard). 8 is up, 2 is down, 4 is left, 6 is right. You can also zoom in & out by pressing - and + (NumKeys). This viewer probably will be extended to display SW:EAW models if I have the time to do this. ----------- INI Editor ----------- For Generals & LOTR Ini style files! Easy to use. Right click and you'll be presented with several options regarding the clicked item. For example, if you click inside an Object module you'll be presented with a list of Modules/Values to insert. For many values you can also use Set Value, which will present you a list of values. Just try it out in the several sections of an INI file. If you click onto GoTo, another menu pops up that allows you to jump to the several sections inside the current INI file. Basically, you do not have to use the INI Editor menu, you can do everything by typing, too. FinalBIG does not take away your freedom to plainly edit the INI by hand, it just additionally supports some helper features. ---------------- External Editors ---------------- Simple: Define your favorite editors using View->Options. Once you have done that, close the dialog. Then simply select the file to edit at the left and press CTRL+E (or Edit->Edit with Editor). FinalBIG will then launch the editor with the selected file. If you want to change the file, don't forget to save the file in the editor (without changing the filename). While the editor is opened, FinalBIG will block access to this specific file. This is to avoid sharing difficulties. ---------------- Quick Save ---------------- Currently only implemented for BIG files, this feature tries to only save any changed files inside the BIG file. That way, it does need much less time than saving several hundred MB of unchanged data. Keep in mind that this can increase the BIG file, so before distributing, use the normal Save command. For MEG files, this just works as pressing Save, thus rewriting the whole MEG. However, I will work on implementing this feature for MEG files, too. ---------------- MEG File Support ---------------- Keep in mind that MEG files do not support lowercase letters inside filenames. FinalBIG automatically changes those to uppercase letters. --------------- TODO List --------------- - Support QuickSave for MEG files (Top prio) - Probably add viewer for SW:EAW models - Probably add XML Editor with more features - Probably add Texture->DDS support (for converting for example TGA's, BMP's etc into DDS format) ---------------------- Changes in 0.4 (beta) ---------------------- - Support for saving & loading MEG files of Star Wars(TM): Empire At War(TM) - Support for DDS texture loading extended for SW: EAW ---------------------- Changes in 0.36 (beta) ---------------------- - External Editor support: Use your favorite editors (like PSP, Wordpad, etc) to directly edit files inside the BIG file! ---------------------- Changes in 0.35 (beta) ---------------------- - INI Editor extended: Lists modules & values and allows to set values *** IMPORTANT: I'm searching for people willing to complete the module list! *** - Adding a file to a BIG that already exists will now overwrite the original file (you'll be asked) - It may now be possible to open BIG files of other games than Generals/LOTR if the file format is compatible ------------------- Changes in 0.34 ------------------- - INI Editor - Quick Save ------------------- Changes in 0.33 ------------------- - W3D Viewer now displays (almost) all W3Ds correctly, including skins - JPEG and PNG support - Image viewer now uses correct aspect ratio (if width!=height) - Manual rotation and zooming possible in W3D viewer ------------------- Changes in 0.32 ------------------- - W3D viewer now displays all W3Ds correctly except skin meshes - W3D viewer now also displays textures (DDS, TGA and BMP) - D3D9 support (optionally) ------------------- Changes in 0.31 ------------------- - Added simple W3D viewer (no mesh hierarchy/textures supported yet, will come asap) - Fixed Crash Bug when pressing Cancel when inserting a directory ------------------- Changes in 0.3 ------------------- - Added Support for LOTR:BFME - Added TGA, BMP & DDS Viewer ------------------- Changes in 0.21 ------------------- - Fixed crash that occured sometimes when deleting files ------------------- Changes in 0.2 ------------------- - Deleting files - Renaming files - Drag & Drop for adding files & directories - Including the folder name when inserting a directory instead of skipping it
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值