64位的CentOS上编译 Hadoop 2.2.0

编译需要安装的软件:
1.yum install  svn
2.yum install  autoconfautomake libtool cmake
3.yum install  ncurses-devel
4.yum install  openssl-devel
5.yum install  gcc*
6.wget http://mirror.esocc.com/apache/maven/maven-3/3.1.4/binaries/apache-maven-3.1.4-bin.tar.gz
7.wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
$ tar zxf protobuf-2.5.0.tar.gz

1. 下载Hadoop 2.2.0 源码包,并解压
$ wget http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz
$ tar zxf hadoop-2.2.0-src.tar.gz

2. 安装下面的软件
$ sudo yum install cmake lzo-devel  zlib-devel  gcc autoconf automake libtool   ncurses-devel openssl-deve glibc-headers gcc-c++

3. 安装Maven
$ wget http://mirror.esocc.com/apache/maven/maven-3/3.1.4/binaries/apache-maven-3.1.4-bin.tar.gz
$  tar zxf apache-maven-3.1.4-bin.tar.gz -C /opt
$  vi ~/.bashrc
export MAVEN_HOME=/opt/apache-maven-3.1.4
export PATH=$PATH:$MAVEN_HOME/bin

4. 安装protobuf
        编译Hadoop 2.2.0,需要protobuf的编译器protoc。一定需要protobuf 2.5.0以上,yum里的是2.3,下载源码,编译安装。
$ wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
$ tar zxf protobuf-2.5.0.tar.gz
$ cd protobuf-2.5.0
$ ./configure
$ make
$ make install

5. 给Hadoop源码打一个patch
cd /opt/program/hadoop-2.2.0-src
 wget https://issues.apache.org/jira/secure/attachment/12614482/HADOOP-10110.patch; patch -p0 < HADOOP-10110.patch 

#让设置生效
source ~/.bashrc
6. 编译 Hadoop
cd hadoop-2.2.0-src
mvn package -DskipTests -Pdist,native -Dtar

7. 替换掉32位的native库
用 hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/lib/native 替换掉 hadoop-2.2.0/lib/native
rm -rf ~/local/opt/hadoop-2.2.0/lib/native
cp ./hadoop-dist/target/hadoop-2.2.0/lib/native ~/local/opt/hadoop-2.2.0/lib/

你可能感兴趣的:(编译,cetos64,hadoop2.2)