欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

64位的CentOS上编译 Hadoop 2.2.0

程序员文章站 2022-05-31 11:38:20
...
[b]编译需要安装的软件:[/b]
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

[b]1. 下载Hadoop 2.2.0 源码包,并解压[/b]
$ 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

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

[b]3. 安装Maven[/b]
$ 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

[b]4. 安装protobuf[/b]
[color=red]编译Hadoop 2.2.0,需要protobuf的编译器protoc。一定需要protobuf 2.5.0以上,yum里的是2.3,下载源码,编译安装。[/color]
$ 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

[b]5. 给Hadoop源码打一个patch[/b]
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

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

[b]7. 替换掉32位的native库[/b]
用 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/