ubuntu下编译Hadoop

Ubuntu 下编译 Hadoop-2.9.2

系统环境

系统: ubuntu-18.10-desktop-amd64
maven: Apache Maven 3.6.0
jdk: jdk_1.8.0_201
ProtocolBuffer: portoc-2.5.0
OpenSSL: OpenSSL 1.1.1
cmake: cmake3.12.1
hadoop: hadoop-2.9.2

安装所需环境

# 安装各种所需依赖库
$ sudo apt-get install autoconf automake libtool zlib1g-dev pkg-config libssl-dev libsnappy-dev libbz2-dev

# 安装ssh-server
$ sudo apt-get install ssh-server

# 安装openssl
$ sudo apt-get install openssl

# 安装cmake
$ sudo apt-get install cmake 

# 安装编译c++库
$ sudo apt-get install g++

# 安装protobuf
# 下载protobuf-2.5.0
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

# 解压缩
$ tar -zxvf protobuf-2.5.0.tar.gz

# 进入protobuf解压缩目录配置
$ ./configur --prefix=/usr/local/protoc-2.5.0

# 编译安装
$ make && make install

# 配置到环境变量中~/.bash_profile
export PATH="/usr/local/protoc-2.5.0/bin:$PATH"

编译过程中可能遇到的问题

注意 libssl-dev安装换成 libssl1.0-dev版本。 我之前就是默认安转,在编译OpenSSL功能的时候一直卡主编译不通过。具体错误形式如下

[exec] make[2]: *** [CMakeFiles/hadoop_static.dir/main/native/src/org/apache/hadoop/crypto/OpensslCipher.c.o] Error 1
[exec] make[1]: *** [CMakeFiles/hadoop_static.dir/all] Error 2
[exec] make: *** [all] Error 2
# 移除libssl-dev
$ sudo apt-get remote libssl-dev

# 安装libssl1.0-dev
$ sudo apt-get install libssl1.0-dev

开始编译 hadoop

$ mvn package -Pdist,native -DskipTests -Dtar

命令执行后需要等待他下载编译所需的所有依赖过程可能会很久

[INFO] Reactor Summary for Apache Hadoop Main 2.9.2:
[INFO] 
[INFO] Apache Hadoop Main ................................. SUCCESS [  0.758 s]
[INFO] Apache Hadoop Build Tools .......................... SUCCESS [  0.426 s]
[INFO] Apache Hadoop Project POM .......................... SUCCESS [  0.470 s]
[INFO] Apache Hadoop Annotations .......................... SUCCESS [  1.169 s]
[INFO] Apache Hadoop Assemblies ........................... SUCCESS [  0.134 s]
[INFO] Apache Hadoop Project Dist POM ..................... SUCCESS [  1.145 s]
[INFO] Apache Hadoop Maven Plugins ........................ SUCCESS [  2.224 s]
[INFO] Apache Hadoop MiniKDC .............................. SUCCESS [  1.923 s]
[INFO] Apache Hadoop Auth ................................. SUCCESS [  2.653 s]
[INFO] Apache Hadoop Auth Examples ........................ SUCCESS [  1.823 s]
[INFO] Apache Hadoop Common ............................... SUCCESS [ 40.786 s]
[INFO] Apache Hadoop NFS .................................. SUCCESS [  2.925 s]
[INFO] Apache Hadoop KMS .................................. SUCCESS [  8.053 s]
[INFO] Apache Hadoop Common Project ....................... SUCCESS [  0.050 s]
[INFO] Apache Hadoop HDFS Client .......................... SUCCESS [ 46.997 s]
[INFO] Apache Hadoop HDFS ................................. SUCCESS [ 42.883 s]
[INFO] Apache Hadoop HDFS Native Client ................... SUCCESS [  5.907 s]
[INFO] Apache Hadoop HttpFS ............................... SUCCESS [ 11.476 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal .............. SUCCESS [  5.320 s]
[INFO] Apache Hadoop HDFS-NFS ............................. SUCCESS [  2.055 s]
[INFO] Apache Hadoop HDFS-RBF ............................. SUCCESS [ 11.390 s]
[INFO] Apache Hadoop HDFS Project ......................... SUCCESS [  0.053 s]
[INFO] Apache Hadoop YARN ................................. SUCCESS [  0.045 s]
[INFO] Apache Hadoop YARN API ............................. SUCCESS [  8.620 s]
[INFO] Apache Hadoop YARN Common .......................... SUCCESS [ 25.431 s]
[INFO] Apache Hadoop YARN Registry ........................ SUCCESS [  2.577 s]
[INFO] Apache Hadoop YARN Server .......................... SUCCESS [  0.067 s]
[INFO] Apache Hadoop YARN Server Common ................... SUCCESS [  6.540 s]
[INFO] Apache Hadoop YARN NodeManager ..................... SUCCESS [ 25.577 s]
[INFO] Apache Hadoop YARN Web Proxy ....................... SUCCESS [  1.779 s]
[INFO] Apache Hadoop YARN ApplicationHistoryService ....... SUCCESS [ 11.509 s]
[INFO] Apache Hadoop YARN Timeline Service ................ SUCCESS [  2.671 s]
[INFO] Apache Hadoop YARN ResourceManager ................. SUCCESS [ 12.742 s]
[INFO] Apache Hadoop YARN Server Tests .................... SUCCESS [  0.760 s]
[INFO] Apache Hadoop YARN Client .......................... SUCCESS [  3.285 s]
[INFO] Apache Hadoop YARN SharedCacheManager .............. SUCCESS [  1.976 s]
[INFO] Apache Hadoop YARN Timeline Plugin Storage ......... SUCCESS [  1.730 s]
[INFO] Apache Hadoop YARN Router .......................... SUCCESS [  2.516 s]
[INFO] Apache Hadoop YARN TimelineService HBase Backend ... SUCCESS [ 23.469 s]
[INFO] Apache Hadoop YARN Timeline Service HBase tests .... SUCCESS [  1.727 s]
[INFO] Apache Hadoop YARN Applications .................... SUCCESS [  0.037 s]
[INFO] Apache Hadoop YARN DistributedShell ................ SUCCESS [  1.611 s]
[INFO] Apache Hadoop YARN Unmanaged Am Launcher ........... SUCCESS [  1.039 s]
[INFO] Apache Hadoop YARN Site ............................ SUCCESS [  0.041 s]
[INFO] Apache Hadoop YARN UI .............................. SUCCESS [  0.027 s]
[INFO] Apache Hadoop YARN Project ......................... SUCCESS [  4.166 s]
[INFO] Apache Hadoop MapReduce Client ..................... SUCCESS [  0.126 s]
[INFO] Apache Hadoop MapReduce Core ....................... SUCCESS [ 11.880 s]
[INFO] Apache Hadoop MapReduce Common ..................... SUCCESS [  8.171 s]
[INFO] Apache Hadoop MapReduce Shuffle .................... SUCCESS [  1.818 s]
[INFO] Apache Hadoop MapReduce App ........................ SUCCESS [  4.549 s]
[INFO] Apache Hadoop MapReduce HistoryServer .............. SUCCESS [  2.999 s]
[INFO] Apache Hadoop MapReduce JobClient .................. SUCCESS [  3.505 s]
[INFO] Apache Hadoop MapReduce HistoryServer Plugins ...... SUCCESS [  1.104 s]
[INFO] Apache Hadoop MapReduce Examples ................... SUCCESS [  2.656 s]
[INFO] Apache Hadoop MapReduce ............................ SUCCESS [  2.052 s]
[INFO] Apache Hadoop MapReduce Streaming .................. SUCCESS [  9.580 s]
[INFO] Apache Hadoop Distributed Copy ..................... SUCCESS [  2.545 s]
[INFO] Apache Hadoop Archives ............................. SUCCESS [  1.964 s]
[INFO] Apache Hadoop Archive Logs ......................... SUCCESS [  1.355 s]
[INFO] Apache Hadoop Rumen ................................ SUCCESS [  2.651 s]
[INFO] Apache Hadoop Gridmix .............................. SUCCESS [  2.451 s]
[INFO] Apache Hadoop Data Join ............................ SUCCESS [  1.281 s]
[INFO] Apache Hadoop Ant Tasks ............................ SUCCESS [  0.910 s]
[INFO] Apache Hadoop Extras ............................... SUCCESS [  1.269 s]
[INFO] Apache Hadoop Pipes ................................ SUCCESS [  4.864 s]
[INFO] Apache Hadoop OpenStack support .................... SUCCESS [  2.166 s]
[INFO] Apache Hadoop Amazon Web Services support .......... SUCCESS [ 17.425 s]
[INFO] Apache Hadoop Azure support ........................ SUCCESS [  3.589 s]
[INFO] Apache Hadoop Aliyun OSS support ................... SUCCESS [  1.737 s]
[INFO] Apache Hadoop Client ............................... SUCCESS [  4.883 s]
[INFO] Apache Hadoop Mini-Cluster ......................... SUCCESS [  0.535 s]
[INFO] Apache Hadoop Scheduler Load Simulator ............. SUCCESS [  3.363 s]
[INFO] Apache Hadoop Resource Estimator Service ........... SUCCESS [  2.404 s]
[INFO] Apache Hadoop Azure Data Lake support .............. SUCCESS [  1.732 s]
[INFO] Apache Hadoop Tools Dist ........................... SUCCESS [ 17.061 s]
[INFO] Apache Hadoop Tools ................................ SUCCESS [  0.035 s]
[INFO] Apache Hadoop Distribution ......................... SUCCESS [ 42.773 s]
[INFO] Apache Hadoop Cloud Storage ........................ SUCCESS [  2.183 s]
[INFO] Apache Hadoop Cloud Storage Project ................ SUCCESS [  0.229 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  08:19 min
[INFO] Finished at: 2019-05-08T17:23:30+08:00
[INFO] ------------------------------------------------------------------------
leone@leone-ubuntu:~/Downloads/hadoop-2.9.2-src$ 

大功告成编译后的hadoop放在hadoop-2.9.2-src\hadoop-dist\target目录下。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,222评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,455评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,720评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,568评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,696评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,879评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,028评论 3 409
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,773评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,220评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,550评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,697评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,360评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,002评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,782评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,010评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,433评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,587评论 2 350

推荐阅读更多精彩内容

  • 总想让自己的生活丰富起来,似乎总想拿计划来要求自己,让它成为我前进的动力,也看了很多人写的生活总结,满满的...
    朴逸夫人阅读 425评论 0 1
  • duet可以把ipad扩展为你的第二块显示器。 1,首先去appstore下载ipad版的duet,安装,之后下载...
    鸭梨山大哎阅读 37,568评论 3 3
  • 臀腿日 肩膀手臂日 腰、腹日 胸背日 流程——热身、无氧、有网(高强) 饮食
    里巳阅读 176评论 0 0
  • 1.下载SHP2SDO放到装有ORACLE服务端的服务器,任意盘(例:D盘,选择对应版本 windows版本) 2...
    一角钱技术阅读 1,070评论 0 0