1、配置网络环境及jar准备
hadoop-2.7.2-src.tar.gz
jdk-8u144-linux-x64.tar.gz
apache-ant-1.9.9-bin.tar.gz(build工具,打包用的)
apache-maven-3.0.5-bin.tar.gz
protobuf-2.5.0.tar.gz(序列化的框架)
2、安装jar包
a. JDK解压、配置环境变量 JAVA_HOME和PATH,验证java -version(如下都需要验证是否配置成功)
配置环境变量
vi /etc/profile
#JAVA_HOME:
export JAVA_HOME=/opt/module/jdk1.8.0_144
export PATH=$PATH:$JAVA_HOME/bin
重启环境变量配置
source /etc/profile
查看是否生效
java -version
b. Maven解压、配置 MAVEN_HOME和PATH
设置阿里镜像源
vim /opt/module/apache-maven-3.0.5/conf/settings.xml
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
配置环境变量
vim /etc/profile
# MAVEN_HOME
export MAVEN_HOME=/opt/module/apache-maven-3.0.5
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
验证配置
mvn -version
c. ant解压、配置 ANT _HOME和PATH
vi /etc/profile
#ANT_HOME
export ANT_HOME=/opt/module/apache-ant-1.9.9
export PATH=$PATH:$ANT_HOME/bin
source /etc/profile
ant -version
d. 安装 glibc-headers 和 g++
yum源失效参考linux篇
yum install glibc-headers
yum install gcc-c++
e. 安装make和cmake
yum install make
yum install cmake
f. 解压protobuf ,进入protobuf主目录,/opt/module/protobuf-2.5.0,相继执行命令
./configure
make
make check
make install
ldconfig
配置环境变量
vim /etc/profile
#LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/module/protobuf-2.5.0
export PATH=$PATH:$LD_LIBRARY_PATH
source /etc/profile
protoc --version
g. 安装openssl库和ncurses-devel库
yum install openssl-devel
yum install ncurses-devel
编译工具安装基本完成
3. 编译源码
a. 解压源码到/opt/目录
tar -zxvf hadoop-2.7.2-src.tar.gz -C /opt/
b. 进入到hadoop源码主目录
cd /opt/hadoop-2.7.2-src
c. 通过maven执行编译命令
mvn package -Pdist,native -DskipTests -Dtar
最终成功是全部SUCCESS