1)jar包准备(Hadoop源码,JDK7,maven,ant,protobuf)
hadoop-2.7.2-src.tar.gz
jdk-7u79-linux-x64.gz
apache-ant-1.9.9-bin.tar.gz
apache-maven-3.0.5-bin.tar.gz
protobuf-2.5.0.tar.gz
2)jar包安装
JDK安装配置JAVA_HOME和PATH 输入java -version验证
Maven安装配置MAVEN_HOME和PATH 输入mvn -version验证
ant安装配置ANT_HOME和PATH 输入ant -version验证
3)安装glibc-headers和g++
$ yum install glibc-headers
$ yum install gcc-c++
4)安装make和cmake
$ yum install make
$ yum install cmake
5)解压protobuf,然后执行相应命令
$ tar -zxvf protobuf-2.5.0.tar.gz -C /opt/module/
$ cd /opt/module/protobuf-2.5.0/
$ ./configure
$ make
$ make check
$ make install
$ ldconfig
#配置环境变量
$ vim /etc/profile
export LD_LIBRARY_PATH=/opt/module/protobuf-2.5.0
export PATH=$PATH:$LD_LIBRARY_PATH
$ source /etc/profile
$ protoc --version #验证
6)安装openssl库
$ yum install openssl-devel
7)安装ncureses-devel库
$ yum install ncurses-devel
8)编译源码
a)解压源码到 /opt/tools 目录
$ tar -zxvf hadoop-2.7.2-src.tar.gz -C /opt/
b)进入源码目录,通过maven执行编译命令
$ mvn package -Pdist.native -DskipTests -Dtar
成功后64位hadoop包在/opt/hadoop-2.7.2-src/hadoop-dist/target下
网友评论