Hadoop基础教程-第13章 源码编译(13.1 Zookeeper源码编译)

第13章 源码编译

13.1 Zookeeper源码编译

13.1.1 安装Ant

注意,不要下载最新版,下载指定版本 http://archive.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz

解压缩

[root@hadron ~]# cd apache-ant-1.9.4/
[root@hadron apache-ant-1.9.4]# ll
总用量 380
drwxr-xr-x 2 root root   4096 4月  30 2014 bin
drwxr-xr-x 3 root root   4096 4月  30 2014 etc
-rw-r--r-- 1 root root  11253 4月  30 2014 fetch.xml
-rw-r--r-- 1 root root   4445 4月  30 2014 get-m2.xml
-rw-r--r-- 1 root root    126 4月  30 2014 INSTALL
-rw-r--r-- 1 root root  92261 4月  30 2014 KEYS
drwxr-xr-x 2 root root   4096 4月  30 2014 lib
-rw-r--r-- 1 root root  15289 4月  30 2014 LICENSE
drwxr-xr-x 8 root root   4096 4月  30 2014 manual
-rw-r--r-- 1 root root    305 4月  30 2014 NOTICE
-rw-r--r-- 1 root root   4119 4月  30 2014 README
-rw-r--r-- 1 root root 225057 4月  30 2014 WHATSNEW
[root@hadron apache-ant-1.9.4]#

13.1.2 下载Zookeeper源码

[root@hadron ~]# git clone https://github.com/apache/zookeeper.git
正克隆到 'zookeeper'...
remote: Counting objects: 35618, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 35618 (delta 0), reused 5 (delta 0), pack-reused 35606
接收对象中: 100% (35618/35618), 28.06 MiB | 81.00 KiB/s, done.
处理 delta 中: 100% (23152/23152), done.
您在 /var/spool/mail/root 中有新邮件
[root@hadron ~]# cd zookeeper/
[root@hadron zookeeper]# ll
总用量 160
drwxr-xr-x 2 root root  4096 7月  26 09:45 bin
-rw-r--r-- 1 root root 82419 7月  26 09:45 build.xml
drwxr-xr-x 2 root root  4096 7月  26 09:45 conf
drwxr-xr-x 4 root root  4096 7月  26 09:45 docs
-rw-r--r-- 1 root root  1709 7月  26 09:45 ivysettings.xml
-rw-r--r-- 1 root root  4132 7月  26 09:45 ivy.xml
-rw-r--r-- 1 root root 11358 7月  26 09:45 LICENSE.txt
-rw-r--r-- 1 root root   170 7月  26 09:45 NOTICE.txt
-rw-r--r-- 1 root root  1347 7月  26 09:45 README_packaging.txt
-rw-r--r-- 1 root root  1636 7月  26 09:45 README.txt
drwxr-xr-x 7 root root  4096 7月  26 09:45 src
-rw-r--r-- 1 root root 21462 7月  26 09:45 zk-merge-pr.py
[root@hadron zookeeper]# 

13.1.3 查看文档

[root@hadron zookeeper]# cat README_packaging.txt 
README file for Packaging Notes

Requirement
-----------

ant (recommended version 1.9.4 or later for concurrent JUnit test execution)
gcc, cppunit and python-setuptools are required to build 
C and python bindings.

On RHEL machine:

yum install cppunit
yum install python-setuptools

On Ubuntu:

apt-get --install cppunit
apt-get --install python-setuptools

Package build command
---------------------

The ZooKeeper project publishes releases as tarballs.  For ZooKeeper packages
specific to your OS (such as rpm and deb), consider using Apache Bigtop:

http://bigtop.apache.org/

Command to build tarball package: ant tar

zookeeper-<version>.tar.gz tarball file structure layout

  /bin                               - User executable
  /sbin                              - System executable
  /libexec                           - Configuration boot trap script
  /lib                               - Library dependencies
  /docs                              - Documents
  /share/zookeeper                   - Project files

Command to build tarball package with native components: ant package-native tar

zookeeper-<version>-lib.tar.gz tarball file structure layout

  /bin                               - User executable
  /lib                               - Native libraries
  /include/zookeeper                 - Native library headers

13.1.4 安装依赖工具

[root@hadron ~]# yum install -y cppunit
[root@hadron ~]# yum install -y python-setuptools

13.1.5 开始编译

(1)初次编译

[root@hadron zookeeper]# /root/apache-ant-1.9.4/bin/ant tar
Buildfile: /root/zookeeper/build.xml

init:
    [mkdir] Created dir: /root/zookeeper/build/classes
    [mkdir] Created dir: /root/zookeeper/build/lib
    [mkdir] Created dir: /root/zookeeper/build/package/lib
    [mkdir] Created dir: /root/zookeeper/build/test/lib

....
....

check-cppunit-configure:

create-cppunit-configure:
     [exec] Can't exec "aclocal": 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
     [exec] autoreconf: failed to run aclocal: 没有那个文件或目录

BUILD FAILED
/root/zookeeper/build.xml:1276: exec returned: 1

Total time: 30 seconds
[root@hadron zookeeper]# 

(2)解决缺失依赖

解决问题:Can’t exec “aclocal”: 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326

[root@hadron ~]# yum install automake

(3)重新编译

[root@hadron zookeeper]# /root/apache-ant-1.9.4/bin/ant tar
Buildfile: /root/zookeeper/build.xml

init:
.....................
输出省略
.....................

compile:
     [echo] contrib: queue
    [javac] /root/zookeeper/src/recipes/build-recipes.xml:103: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1 source file to /root/zookeeper/build/recipes/queue/classes

jar:
     [echo] recipes: queue
      [jar] Building jar: /root/zookeeper/build/recipes/queue/zookeeper-3.6.0-SNAPSHOT-recipes-queue.jar

zookeeperbuildrecipes.package:
     [echo] recipes: queue
    [mkdir] Created dir: /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue

package:
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue
    [mkdir] Created dir: /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue/test
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue/test
    [mkdir] Created dir: /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue/src
     [copy] Copying 16 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/recipes/queue/src
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT
    [mkdir] Created dir: /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/dist-maven
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/dist-maven
     [copy] Copying 2 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/dist-maven
     [copy] Copying 1 file to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/dist-maven
     [copy] Copying 9 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/bin
     [copy] Copying 3 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/conf
     [copy] Copying 350 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/docs
     [copy] Copying 7 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT
     [copy] Copying 1104 files to /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT/src

tar:
      [tar] Building tar: /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT.tar.gz

BUILD SUCCESSFUL
Total time: 1 minute 27 seconds
您在 /var/spool/mail/root 中有新邮件
[root@hadron zookeeper]# 

注意输出信息BUILD SUCCESSFUL,表示编译成功! (4)查看tar包

[root@hadron zookeeper]# ll /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT.tar.gz
-rw-r--r-- 1 root root 18418052 7月  26 11:02 /root/zookeeper/build/zookeeper-3.6.0-SNAPSHOT.tar.gz
[root@hadron zookeeper]#

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏我是攻城师

驭象者之Apache Oozie

3523
来自专栏后台及大数据开发

Linux巩固记录(7) Hbase安装

接下来依次启动hadoop-》zookeeper(每个几点要分别启动)-》hbase

751
来自专栏Hadoop实操

如何使用HAProxy实现Impala的负载均衡

前面Fayson介绍过《如何使用Nginx实现Impala负载均衡》,正如之前所说Cloudera官网推荐并支持的负载均衡为HAProxy。所以Fayson就介...

4343
来自专栏KaliArch

大数据平台CDH搭建

Cloudera版本(Cloudera’s Distribution Including Apache Hadoop,简称“CDH”),基于Web的用户界面,...

2645
来自专栏大数据

在Ubuntu上启动并运行Hadoop

Hadoop是一个用Java编写的框架,它允许在大型商品硬件集群上以分布式方式处理大型数据集。

1801
来自专栏Hadoop实操

如何通过CM禁用Federation

本文主要讲述如何通过CM禁用Federation。我前面写过两篇关于Federation的文章,可参看《HDFS Federation(联邦)简介》和《如何通过...

874
来自专栏搜云库

HBase-1.3.1 集群搭建

什么是HBase? HBase是建立在Hadoop文件系统之上的分布式面向列的数据库。它是一个开源项目,是横向扩展的。 HBase是一个数据模型,类似于谷歌的大...

1865
来自专栏Hadoop实操

如何在Kerberos的Linux上安装及配置Impala的ODBC驱动

Impala提供了多种访问方式如impala-shell、beeline、JDBC以及ODBC等方式,关于beeline、JDBC的连接方式可以参考Fayson...

3855
来自专栏Hadoop数据仓库

HAWQ技术解析(二) —— 安装部署

一、安装规划 1. 选择安装介质         HAWQ的安装介质有两种选择,一是下载源码手工编译,二是使用Pivotal公司提供的HDB安装包。源码的下载地...

4915
来自专栏about云

spark编译:构建基于hadoop的spark安装包及遇到问题总结

问题导读 1.spark集群能否单独运行? 2.如何在spark中指定想编译的hadoop版本? 3.构建的时候,版本选择需要注意什么? 上一篇 如何查看...

4516

扫码关注云+社区