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 条评论
登录 后参与评论

相关文章

来自专栏草根专栏

使用angular4和asp.net core 2 web api做个练习项目(三)

下面将开发登陆和授权的部分, 这里要用到identity server 4. 在VS解决方案中设置多个项目同时启动: ? AspNetIdentityAutho...

2808
来自专栏王磊的博客

entity framework不查数据库修改或排除指定字段集合通用方法

其中DataDBEntities为数据库实体对象,代码如下: 下载地址:http://files.cnblogs.com/stone_w/EFDBHelper....

2965
来自专栏蓝天

Hive 0.12.0安装指南

本文的安装参照了官方的文档:GettingStarted,将Hive 0.12.0安装在Hadoop 2.4.0上。本文将Hive配置成Server模式,并...

553
来自专栏生信宝典

Airflow配置和使用

Airflow能做什么 Airflow是一个工作流分配管理系统,通过有向非循环图的方式管理任务流程,设置任务依赖关系和时间调度。 Airflow独立于我们要运行...

1.1K6
来自专栏菩提树下的杨过

.net程序员使用Oracle新手上路指南

虽然oracle,sqlserver都是关系型数据库,sql语句大部分也差不多,但是从sqlserver换到oracle还是有很多不适应的地方,本文旨在帮助广大...

1895
来自专栏owent

GCC 7和LLVM+Clang+libc++abi 4.0的构建脚本

之前的版本发完,有空来更新一下之前的gcc和llvm+clang工具链的编译脚本了。其实GCC 7是才release没多久但是llvm 4.0发布其实有一段时间...

531
来自专栏康怀帅的专栏

CoreOS 容器 Rkt 简单介绍

由于 Docker 已经成为事实上的容器老大,这里暂且将 rkt 内容放入 docker 文件夹。哈哈 官方网站:https://coreos.com/rkt/...

3947
来自专栏Seebug漏洞平台

Seebug 漏洞精选集合第一期

这是 Seebug 精选漏洞第一期,主要包含一些硬件设备以及工控类型漏洞,这些漏洞均为一些重要漏洞,并且均包含有基于Pocsuite 编写的PoC! 之后我们将...

4027
来自专栏晓晨的专栏

C#邮件发送类 简单实用 可自定义发件人名称

1024
来自专栏林德熙的博客

wpf 单例

本文告诉大家如何做一个 wpf 单例程序。单例就是用户只能运行这个程序一次,也就是内存只有存在这个程序一个。

352

扫码关注云+社区