一、下载以下软件
软件 | 百度链接 | 提取码 |
---|---|---|
hadoop2.6.0-cdh5.7.0 | https://pan.baidu.com/s/1pylcKbLDI8LmMyKO0yrxJA | 2k7c |
protobuf-2.5.0.tar.gz | https://pan.baidu.com/s/165KNdYfORcKDMoDVk1El7w | 7c37 |
repo.tar | https://pan.baidu.com/s/1IrNJclLE52xwVRDbL7Tgmg | 56t1 |
二、安装依赖库
[root@hadoop001 ~]# yum install -y svn ncurses-devel
[root@hadoop001 ~]# yum install -y gcc gcc-c++ make cmake
[root@hadoop001 ~]# yum install -y openssl openssl-devel svn ncurses-devel zlib-devel libtool
[root@hadoop001 ~]# yum install -y snappy snappy-devel bzip2 bzip2-devel lzo lzo-devel lzop autoconf
三、安装JDK1.8及Maven3.3.9(自行百度安装)
四、安装protobuf
tar -zxvf protobuf-2.5.0.tar.gz -C ../../app/
--------------------------------------------------------------------
cd /home/hadoop/soul/app/protobuf-2.5.0
--------------------------------------------------------------------
./configure --prefix=/home/hadoop/soul/app/protobuf-2.5.0
--------------------------------------------------------------------
make && make install
--------------------------------------------------------------------
添加至环境变量
--------------------------------------------------------------------
查看版本显示以下内容即为配置成功
[hadoop@hadoop000 protobuf-2.5.0]$ protoc --version
libprotoc 2.5.0
五、将依赖包解压至Maven的Repository
解压的包都是编译Hadoop时需要去下载的,拷贝Repository后可以加快编译
[hadoop@hadoop000 soft]$ tar -zxvf repo.tar.gz -C ../data/mvn_repo/
六、编译
[hadoop@hadoop000 source]$ tar -zxvf hadoop-2.6.0-cdh5.7.0-src.tar.gz
--------------------------------------------------------------------
进入加压后的源码目录
[hadoop@hadoop000 source]$ cd hadoop-2.6.0-cdh5.7.0
--------------------------------------------------------------------
执行编译命令
mvn clean package -Pdist,native -DskipTests -Dtar
七、错误解决
错误信息:
image.png
将JDK降级到1.7版本,重新编译。
mvn clean package -Pdist,native -DskipTests -Dtar
mvn clean validate -Denforcer.skip=true -DskipTests -Pdist,native -Dtar
mvn clean package -Dmaven.javadoc.skip=true -Denforcer.skip=true -DskipTests -Pdist,native -Dtar
网友评论