1, 如何安装
1.1 下载完Hadoop源码后,请解压Hadoop, 找到BUILDING.txt文件打开它,这里详细讲解的安装的过程。
(E:\hadoop-2.7.0-src)
2, 安装必要软件(Lunix)
2.1 JDK安装,这里不介绍了,如果不会的请先学习JAVA后,再学习Hadoop。
2.2Maven安装请查看另一篇博客http://blog.csdn.net/wingkoo1986/article/details/46731589
2.3Findbug安装,请先下载,地址为:http://findbugs.sourceforge.net/downloads.html
1) tar -zxvf findbugs-3.0.1.tar.gz
2) vim /etc/profile 插入如下内容
exportFINDBUGS_HOME=/usr/findbugs-3.0.1
export PATH=$PATH:$FINDBUGS_HOME/bin
3) 保存并退出VI编辑器,执行 source /etc/profile 命令使改动生效
2.4ProtocolBuffer安装必须使用2.5.0。下载地址 https://code.google.com/p/protobuf/downloads/list
1)tar -zxvf protobuf-2.5.0.tar.gz(必须是2.5.0版本的,不然编译hadoop的时候报错)
2)cd protobuf-2.5.0
3)执行:yum install gcc-c++,如果没有安装会包如下的错误
configure: error: in `/root/protobuf-2.5.0':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
4)./configure --prefix=/usr/local/protobuf
5) make && make install
6)vim /etc/profile 设置环境变量(如下命令)
exportPATH=$PATH:/usr/local/protobuf/bin
exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/protobuf/lib
7)执行 source /etc/profile 命令使改动生效
2.5安装CMake
下载地址:http://www.cmake.org/download/
1)安装g++和ncurses-devel
yum install gcc-c++
yum install ncurses-devel
2)tar -zxvf cmake-2.8.10.2.tar.gz
3)cd cmake-2.8.10.2
4)./configure --prefix=/usr/local/cmake
5) make && make install
6)vim /etc/profile 设置环境变量(如下命令)
PATH=/usr/local/cmake/bin:$PATH
exportPATH
7)执行 source /etc/profile 命令使改动生效
8)测试cmake --version
2.6安装zlib-devel
yum install zlib-devel
2.7安装openssl-devel
1) yuminstall openssl-devel
2.8安装Jansson
下载地址:http://www.digip.org/jansson/
1) tar -zxvfjansson-2.7.tar.gz
2)cd jansson-2.7
3)./configure
4) make && make install
2.8安装Linux FUSE
下载地址:http://sourceforge.net/projects/fuse/files/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz/download
1) tar -zxvffuse-2.9.3.tar.gz
2)cd fuse-2.9.3
3)./configure
4) make && make install
5)查看fuse是否挂载成功: lsmod|grep fuse
6)若没成功则可通过:“modprobe fuse”命令挂载fuse。
2.9编译Hadoop源码
#cd hadoop
Createbinary distribution without native code and without documentation:
$ mvn package -Pdist -DskipTests -Dtar
Createbinary distribution with native code and with documentation:
$mvn package -Pdist,native,docs -DskipTests -Dtar
Createsource distribution:
$mvn package -Psrc -DskipTests
Create source and binary distributions with native code anddocumentation:
$ mvn package-Pdist,native,docs,src -DskipTests –Dtar(常用的命令)
Createa local staging version of the website (in /tmp/hadoop-site)
$ mvn clean site; mvn site:stage-DstagingDirectory=/tmp/hadoop-site