Hadoop详解(03)-Hadoop编译源码-了解
Hadoop详解(03)-Hadoop编译源码-了解
准备工作
- CentOS联网
配置CentOS能连接外网。Linux虚拟机ping www.baidu.com 是畅通的
- jar包准备(hadoop源码、JDK8、maven、ant 、protobuf)
(1)hadoop-3.1.3-src.tar.gz
(2)jdk-8u212-linux-x64.tar.gz
(3)apache-maven-3.6.3-bin.tar.gz
(4)protobuf-2.5.0.tar.gz(序列化的框架)
(5)cmake-3.13.1.tar.gz
Jar包安装
注意:所有操作都在root用户下完成,采用root角色编译,减少文件夹权限出现问题
上传软件包到服务器/opt/software/hadoop_source目录
[root@localhost hadoop_source]# pwd
/opt/software/hadoop_source
[root@localhost hadoop_source]# ll
total 62856
-rw-r--r--. 1 root root 6874544 Nov 13 22:26 apache-ant-1.10.7-bin.tar.gz
-rw-r--r--. 1 root root 9506321 Nov 13 22:26 apache-maven-3.6.3-bin.tar.gz
-rw-r--r--. 1 root root 6578184 Sep 18 2015 cmake-3.3.2.tar.gz
-rw-r--r--. 1 root root 9190037 Nov 13 22:25 findbugs-3.0.1.zip
-rw-r--r--. 1 root root 29800905 Nov 13 22:26 hadoop-3.1.3-src.tar.gz
-rw-r--r--. 1 root root 2401901 Nov 13 22:25 protobuf-2.5.0.tar.gz
解压软件包指定的目录,例如: /opt/module/hadoop_source
tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /opt/module/hadoop_source/
tar -xzvf cmake-3.3.2.tar.gz -C /opt/module/hadoop_source/
tar -zxvf hadoop-3.1.3-src.tar.gz -C /opt/module/hadoop_source/
tar -zxvf protobuf-2.5.0.tar.gz -C /opt/module/hadoop_source/
[root@localhost hadoop_source]# cd /opt/module/hadoop_source/
[root@localhost hadoop_source]# ll
total 12
drwxr-xr-x. 6 root root 99 Nov 24 19:33 apache-maven-3.6.3
drwxr-xr-x. 14 root root 4096 Nov 24 22:23 cmake-3.3.2
drwxr-xr-x. 18 root root 4096 Sep 12 2019 hadoop-3.1.3-src
drwxr-xr-x. 13 109965 5000 4096 Nov 24 20:30 protobuf-2.5.0
确认Java已安装且配置好环境变量
[root@localhost hadoop_source]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
配置maven环境变量,maven镜像, 并验证
配置maven的环境变量
[root@localhost hadoop_source]# vi /etc/profile
添加如下内容
#MAVEN_HOME
MAVEN_HOME=/opt/module/hadoop_source/apache-maven-3.6.3
PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
重新加载
[root@localhost hadoop_source]# source /etc/profile
修改maven的镜像
[root@localhost ~]# cd /opt/module/hadoop_source/apache-maven-3.6.3/
[root@localhost apache-maven-3.6.3]# vi conf/settings.xml
在 mirrors节点中添加阿里云镜像
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
验证maven环境
[root@localhost apache-maven-3.6.3]# mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/module/hadoop_source/apache-maven-3.6.3
Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_191/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.8-1.el7.elrepo.x86_64", arch: "amd64", family: "unix"
安装相关的依赖
注意安装依赖顺序不可乱,可能会出现依赖找不到问题
# 安装gcc make
yum install -y gcc* make
#安装压缩工具
yum -y install snappy* bzip2* lzo* zlib* lz4* gzip*
#安装一些基本工具
yum -y install openssl* svn ncurses* autoconf automake libtool
#安装扩展源,才可安装zstd
yum -y install epel-release
#安装zstd
yum -y install *zstd*
手动安装cmake
在解压好的cmake目录下,执行 ./bootstrap 进行编译,此过程需较长时间.
[root@localhost ~]# cd /opt/module/hadoop_source/cmake-3.3.2/
[root@localhost cmake-3.13.1]# ./bootstrap
执行安装
[root@localhost cmake-3.3.2]# gmake
[root@localhost cmake-3.3.2]# make install
验证安装是否成功
[root@localhost cmake-3.3.2]# cmake -version
cmake version 3.3.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
安装protobuf
[root@localhost ~]# cd /opt/module/hadoop_source/protobuf-2.5.0/
#依次执行下列命令 --prefix 指定安装到当前目录
[root@localhost protobuf-2.5.0]# ./configure --prefix=/opt/module/hadoop_source/protobuf-2.5.0
[root@localhost hadoop_source]# make && make install
#配置环境变量
[atguigu@hadoop101 protobuf-2.5.0]$ vim /etc/profile
PROTOC_HOME=/opt/module/hadoop_source/protobuf-2.5.0
PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$PROTOC_HOME/bin
[root@localhost protobuf-2.5.0]# source /etc/profile
#验证
[root@localhost protobuf-2.5.0]# protoc --version
libprotoc 2.5.0
到此,软件包安装配置工作完成
编译源码
进入解压后的hadoop源码目录下并执行编译命令
[root@localhost protobuf-2.5.0]# cd /opt/module/hadoop_source/hadoop-3.1.3-src/
[root@localhost hadoop-3.1.3-src]# mvn clean package -DskipTests -Pdist,native -Dtar
编译过程会非常漫长,第一次编译需要下载很多依赖jar包,最终所有的模块全部SUCCESS,如下所示:
- [INFO] ------------------------------------------------------------------------
- [INFO] Reactor Summary for Apache Hadoop Main 3.1.3:
- [INFO]
- [INFO] Apache Hadoop Main ................................. SUCCESS [ 0.981 s]
- [INFO] Apache Hadoop Build Tools .......................... SUCCESS [ 0.852 s]
- [INFO] Apache Hadoop Project POM .......................... SUCCESS [ 0.754 s]
- [INFO] Apache Hadoop Annotations .......................... SUCCESS [ 2.603 s]
- [INFO] Apache Hadoop Assemblies ........................... SUCCESS [ 0.122 s]
- [INFO] Apache Hadoop Project Dist POM ..................... SUCCESS [ 1.125 s]
- [INFO] Apache Hadoop Maven Plugins ........................ SUCCESS [ 3.186 s]
- [INFO] Apache Hadoop MiniKDC .............................. SUCCESS [ 1.455 s]
- [INFO] Apache Hadoop Auth ................................. SUCCESS [ 4.232 s]
- [INFO] Apache Hadoop Auth Examples ........................ SUCCESS [ 1.891 s]
- [INFO] Apache Hadoop Common ............................... SUCCESS [02:21 min]
- [INFO] Apache Hadoop NFS .................................. SUCCESS [ 4.183 s]
- [INFO] Apache Hadoop KMS .................................. SUCCESS [ 17.735 s]
- [INFO] Apache Hadoop Common Project ....................... SUCCESS [ 0.047 s]
- [INFO] Apache Hadoop HDFS Client .......................... SUCCESS [01:53 min]
- [INFO] Apache Hadoop HDFS ................................. SUCCESS [02:06 min]
- [INFO] Apache Hadoop HDFS Native Client ................... SUCCESS [ 4.489 s]
- [INFO] Apache Hadoop HttpFS ............................... SUCCESS [ 13.033 s]
- [INFO] Apache Hadoop HDFS-NFS ............................. SUCCESS [ 2.463 s]
- [INFO] Apache Hadoop HDFS-RBF ............................. SUCCESS [ 15.698 s]
- [INFO] Apache Hadoop HDFS Project ......................... SUCCESS [ 0.041 s]
- [INFO] Apache Hadoop YARN ................................. SUCCESS [ 0.040 s]
- [INFO] Apache Hadoop YARN API ............................. SUCCESS [ 12.451 s]
- [INFO] Apache Hadoop YARN Common .......................... SUCCESS [03:25 min]
- [INFO] Apache Hadoop YARN Registry ........................ SUCCESS [ 9.642 s]
- [INFO] Apache Hadoop YARN Server .......................... SUCCESS [ 0.029 s]
- [INFO] Apache Hadoop YARN Server Common ................... SUCCESS [01:02 min]
- [INFO] Apache Hadoop YARN NodeManager ..................... SUCCESS [ 30.559 s]
- [INFO] Apache Hadoop YARN Web Proxy ....................... SUCCESS [ 2.942 s]
- [INFO] Apache Hadoop YARN ApplicationHistoryService ....... SUCCESS [ 26.503 s]
- [INFO] Apache Hadoop YARN Timeline Service ................ SUCCESS [ 9.220 s]
- [INFO] Apache Hadoop YARN ResourceManager ................. SUCCESS [ 30.232 s]
- [INFO] Apache Hadoop YARN Server Tests .................... SUCCESS [ 0.892 s]
- [INFO] Apache Hadoop YARN Client .......................... SUCCESS [ 4.010 s]
- [INFO] Apache Hadoop YARN SharedCacheManager .............. SUCCESS [ 2.382 s]
- [INFO] Apache Hadoop YARN Timeline Plugin Storage ......... SUCCESS [ 2.250 s]
- [INFO] Apache Hadoop YARN TimelineService HBase Backend ... SUCCESS [ 0.094 s]
- [INFO] Apache Hadoop YARN TimelineService HBase Common .... SUCCESS [ 41.098 s]
- [INFO] Apache Hadoop YARN TimelineService HBase Client .... SUCCESS [01:50 min]
- [INFO] Apache Hadoop YARN TimelineService HBase Servers ... SUCCESS [ 0.030 s]
- [INFO] Apache Hadoop YARN TimelineService HBase Server 1.2 SUCCESS [ 3.158 s]
- [INFO] Apache Hadoop YARN TimelineService HBase tests ..... SUCCESS [02:32 min]
- [INFO] Apache Hadoop YARN Router .......................... SUCCESS [ 3.164 s]
- [INFO] Apache Hadoop YARN Applications .................... SUCCESS [ 0.047 s]
- [INFO] Apache Hadoop YARN DistributedShell ................ SUCCESS [ 2.130 s]
- [INFO] Apache Hadoop YARN Unmanaged Am Launcher ........... SUCCESS [ 1.590 s]
- [INFO] Apache Hadoop MapReduce Client ..................... SUCCESS [ 0.172 s]
- [INFO] Apache Hadoop MapReduce Core ....................... SUCCESS [ 32.555 s]
- [INFO] Apache Hadoop MapReduce Common ..................... SUCCESS [ 16.913 s]
- [INFO] Apache Hadoop MapReduce Shuffle .................... SUCCESS [ 2.936 s]
- [INFO] Apache Hadoop MapReduce App ........................ SUCCESS [ 5.723 s]
- [INFO] Apache Hadoop MapReduce HistoryServer .............. SUCCESS [ 3.798 s]
- [INFO] Apache Hadoop MapReduce JobClient .................. SUCCESS [ 3.924 s]
- [INFO] Apache Hadoop Mini-Cluster ......................... SUCCESS [ 0.554 s]
- [INFO] Apache Hadoop YARN Services ........................ SUCCESS [ 0.026 s]
- [INFO] Apache Hadoop YARN Services Core ................... SUCCESS [ 15.753 s]
- [INFO] Apache Hadoop YARN Services API .................... SUCCESS [ 0.765 s]
- [INFO] Apache Hadoop YARN Site ............................ SUCCESS [ 0.027 s]
- [INFO] Apache Hadoop YARN UI .............................. SUCCESS [ 0.836 s]
- [INFO] Apache Hadoop YARN Project ......................... SUCCESS [ 6.716 s]
- [INFO] Apache Hadoop MapReduce HistoryServer Plugins ...... SUCCESS [ 5.620 s]
- [INFO] Apache Hadoop MapReduce NativeTask ................. SUCCESS [ 47.760 s]
- [INFO] Apache Hadoop MapReduce Uploader ................... SUCCESS [ 1.505 s]
- [INFO] Apache Hadoop MapReduce Examples ................... SUCCESS [ 3.326 s]
- [INFO] Apache Hadoop MapReduce ............................ SUCCESS [ 3.788 s]
- [INFO] Apache Hadoop MapReduce Streaming .................. SUCCESS [ 13.515 s]
- [INFO] Apache Hadoop Distributed Copy ..................... SUCCESS [ 3.195 s]
- [INFO] Apache Hadoop Archives ............................. SUCCESS [ 1.461 s]
- [INFO] Apache Hadoop Archive Logs ......................... SUCCESS [ 1.569 s]
- [INFO] Apache Hadoop Rumen ................................ SUCCESS [ 8.515 s]
- [INFO] Apache Hadoop Gridmix .............................. SUCCESS [ 2.649 s]
- [INFO] Apache Hadoop Data Join ............................ SUCCESS [ 1.873 s]
- [INFO] Apache Hadoop Extras ............................... SUCCESS [ 1.511 s]
- [INFO] Apache Hadoop Pipes ................................ SUCCESS [ 4.113 s]
- [INFO] Apache Hadoop OpenStack support .................... SUCCESS [ 7.416 s]
- [INFO] Apache Hadoop Amazon Web Services support .......... SUCCESS [02:40 min]
- [INFO] Apache Hadoop Kafka Library support ................ SUCCESS [ 09:50 h]
- [INFO] Apache Hadoop Azure support ........................ SUCCESS [ 25.711 s]
- [INFO] Apache Hadoop Aliyun OSS support ................... SUCCESS [ 37.034 s]
- [INFO] Apache Hadoop Client Aggregator .................... SUCCESS [ 1.356 s]
- [INFO] Apache Hadoop Scheduler Load Simulator ............. SUCCESS [ 4.156 s]
- [INFO] Apache Hadoop Resource Estimator Service ........... SUCCESS [ 12.507 s]
- [INFO] Apache Hadoop Azure Data Lake support .............. SUCCESS [ 23.888 s]
- [INFO] Apache Hadoop Image Generation Tool ................ SUCCESS [ 2.220 s]
- [INFO] Apache Hadoop Tools Dist ........................... SUCCESS [ 8.810 s]
- [INFO] Apache Hadoop Tools ................................ SUCCESS [ 0.027 s]
- [INFO] Apache Hadoop Client API ........................... SUCCESS [01:56 min]
- [INFO] Apache Hadoop Client Runtime ....................... SUCCESS [01:06 min]
- [INFO] Apache Hadoop Client Packaging Invariants .......... SUCCESS [ 4.242 s]
- [INFO] Apache Hadoop Client Test Minicluster .............. SUCCESS [02:06 min]
- [INFO] Apache Hadoop Client Packaging Invariants for Test . SUCCESS [ 0.116 s]
- [INFO] Apache Hadoop Client Packaging Integration Tests ... SUCCESS [ 0.086 s]
- [INFO] Apache Hadoop Distribution ......................... SUCCESS [01:13 min]
- [INFO] Apache Hadoop Client Modules ....................... SUCCESS [ 0.038 s]
- [INFO] Apache Hadoop Cloud Storage ........................ SUCCESS [ 0.443 s]
- [INFO] Apache Hadoop Cloud Storage Project ................ SUCCESS [ 0.029 s]
- [INFO] ------------------------------------------------------------------------
- [INFO] BUILD SUCCESS
- [INFO] ------------------------------------------------------------------------
- [INFO] Total time: 10:24 h
- [INFO] Finished at: 2021-11-24T19:56:26-05:00
- [INFO] ------------------------------------------------------------------------
成功的64位hadoop包位/hadoop-3.1.3-src/hadoop-dist/target下的hadoop-3.1.3.tar.gz压缩包
[root@localhost hadoop-3.1.3-src]# cd hadoop-dist/target/
[root@localhost target]# ll
total 287544
drwxr-xr-x. 2 root root 28 Nov 25 08:55 antrun
drwxr-xr-x. 3 root root 22 Nov 25 08:55 classes
drwxr-xr-x. 9 root root 149 Nov 25 08:55 hadoop-3.1.3
-rw-r--r--. 1 root root 294442930 Nov 25 08:55 hadoop-3.1.3.tar.gz
drwxr-xr-x. 3 root root 22 Nov 25 08:55 maven-shared-archive-resources
drwxr-xr-x. 3 root root 22 Nov 25 08:55 test-classes
drwxr-xr-x. 2 root root 6 Nov 25 08:55 test-dir
Hadoop详解(03)-Hadoop编译源码-了解的更多相关文章
- Hadoop详解(02)Hadoop集群运行环境搭建
Hadoop详解(02)Hadoop集群运行环境搭建 虚拟机环境准备 虚拟机节点数:3台 操作系统版本:CentOS-7.6-x86-1810 虚拟机 内存4G,硬盘99G IP地址分配 192.16 ...
- Hadoop详解(09) - Hadoop新特性
Hadoop详解(09) - Hadoop新特性 Hadoop2.x新特性 远程主机之间的文件复制 scp实现两个远程主机之间的文件复制 推 push:scp -r hello.txt root@ha ...
- spring事务详解(三)源码详解
系列目录 spring事务详解(一)初探事务 spring事务详解(二)简单样例 spring事务详解(三)源码详解 spring事务详解(四)测试验证 spring事务详解(五)总结提高 一.引子 ...
- Hadoop详解(10) - Hadoop HA高可用
Hadoop详解(10) - Hadoop HA高可用 HA概述 HA(High Availablity),即高可用(7*24小时不中断服务). 实现高可用最关键的策略是消除单点故障.HA严格来说应该 ...
- Hadoop详解(08) - Hadoop企业优化方案.docx
Hadoop详解(08) - Hadoop企业优化方案.docx MapReduce优化 MapReduce 跑的慢的原因 计算机性能:CPU.内存.磁盘健康.网络 I/O 操作优化 (1)数据倾斜 ...
- ThreadLocal类详解:原理、源码、用法
以下是本文目录: 1.从数据库连接探究 ThreadLocal 2.剖析 ThreadLocal 源码 3. ThreadLocal 应用场景 4. 通过面试题理解 ThreadLocal 1.从数据 ...
- 广告行业中那些趣事系列8:详解BERT中分类器源码
最新最全的文章请关注我的微信公众号:数据拾光者. 摘要:BERT是近几年NLP领域中具有里程碑意义的存在.因为效果好和应用范围广所以被广泛应用于科学研究和工程项目中.广告系列中前几篇文章有从理论的方面 ...
- (二十三)原型模式详解(clone方法源码的简单剖析)
作者:zuoxiaolong8810(左潇龙),转载请注明出处,特别说明:本博文来自博主原博客,为保证新博客中博文的完整性,特复制到此留存,如需转载请注明新博客地址即可. 原型模式算是JAVA中最简单 ...
- AlexNet 网络详解及Tensorflow实现源码
版权声明:本文为博主原创文章,未经博主允许不得转载. 1. 图片数据处理 2. 卷积神经网络 2.1. 卷积层 2.2. 池化层 2.3. 全链层 3. AlexNet 4. 用Tensorflow搭 ...
随机推荐
- JPA入门学习集合springboot(一)
1.在pom.xml文件中添加相应依赖 SpringData jpa和数据库MySql <!-- Spring Data JPA 依赖(重要) --> <dependency> ...
- doecker---制作DockerFile并上传Hub
一.DockerFile基础知识 FROM #基础镜像,一切从这里开始构建 MAINTAINER #镜像是谁写的,姓名+邮箱 RUN #镜像构建的时候需要运行的命令 ADD #添加内容,步骤,tomc ...
- Springboot+Vue实现将图片和表单一起提交到后端,同时将图片地址保存到数据库、再次将存储的图片展示到前端vue页面
文章目录 1.实现的效果 2.Vue前端 3.图片上传 4.字段变量根据自己的字段名自行设置(这里不给出了,哈哈哈) 5.method方法 5.1.图片显示在选择框中,同时返回后端存储的地址 5.2查 ...
- 创建Vue工程常用的命令
创建一个vue项目的步骤 1.创建一个名称为myapp的工程 vue init webpack myapp 2.进入工程目录 cd myapp 3.安装 vue-router npm install ...
- AI之强化学习、无监督学习、半监督学习和对抗学习
1.强化学习 @ 目录 1.强化学习 1.1 强化学习原理 1.2 强化学习与监督学习 2.无监督学习 3.半监督学习 4.对抗学习 强化学习(英语:Reinforcement Learning,简称 ...
- JS中对DOM元素的操作
https://www.runoob.com/jquery/jquery-ref-html.html 1.each 遍历 //遍历所有class为checksingle的DOM元素 $(" ...
- 第三方代开的微信小程序更换管理员
(1) 由于第三方代开小程序默认管理员是法人.首先使用法人微信搜索"小程序助手"小程序 (2)点击进入"小程序助手",即可看到自己企业名下未更换管理员的小程序 ...
- 使用jmx exporter采集kafka指标
预置条件 安装kafka.prometheus 使用JMX exporter暴露指标 下载jmx exporter以及配置文件.Jmx exporter中包含了kafka各个组件的指标,如server ...
- 小菜鸡的学习笔记---<正则表达式(1)>
正则表达式学习笔记(1) (纯新手学习笔记,大佬绕路 QAQ) 一.简介 正则表达式就是一种文本模式用来匹配一系列满足特定条件的字符串,可以对比一下数学里面的表达式,比如我们要用一个表达式表示一串数字 ...
- pod(八):pod的调度——将 Pod 指派给节点
目录 一.系统环境 二.前言 三.pod的调度 3.1 pod的调度概述 3.2 pod自动调度 3.2.1 创建3个主机端口为80的pod 3.3 使用nodeName 字段指定pod运行在哪个节点 ...