hadoop编译

----------------------------------------------------------------------------------
Requirements:

* Unix System
* JDK 1.7+
* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac
* Zlib devel (if compiling native code)
* openssl devel (if compiling native hadoop-pipes and to get the best HDFS encryption performance)
* Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)

1.hadoop源代码下载

mkdir -p /opt/sourcecode /opt/software
[[email protected] sourcecode]# pwd
/opt/sourcecode
[[email protected] sourcecode]# ll
total 33756
-rw-r--r--. 1 root root 34523353 Aug 20 12:14 hadoop-2.8.1-src.tar.gz
[[email protected] sourcecode]# tar -xzvf hadoop-2.8.1-src.tar.gz
[[email protected] sourcecode]# ll
total 33760
drwxr-xr-x. 17 root root 4096 Jun 2 14:13 hadoop-2.8.1-src
-rw-r--r--. 1 root root 34523353 Aug 20 12:14 hadoop-2.8.1-src.tar.gz
[[email protected] sourcecode]# cd hadoop-2.8.1-src
[[email protected] hadoop-2.8.1-src]# ll
total 224
-rw-rw-r--. 1 root root 15623 May 24 07:14 BUILDING.txt
drwxr-xr-x. 4 root root 4096 Aug 20 12:44 dev-support
drwxr-xr-x. 3 root root 4096 Aug 20 12:44 hadoop-assemblies
drwxr-xr-x. 3 root root 4096 Aug 20 12:44 hadoop-build-tools
drwxrwxr-x. 2 root root 4096 Aug 20 12:44 hadoop-client
drwxr-xr-x. 10 root root 4096 Aug 20 12:44 hadoop-common-project
drwxr-xr-x. 2 root root 4096 Aug 20 12:44 hadoop-dist
drwxr-xr-x. 8 root root 4096 Aug 20 12:44 hadoop-hdfs-project
drwxr-xr-x. 9 root root 4096 Aug 20 12:44 hadoop-mapreduce-project
drwxr-xr-x. 3 root root 4096 Aug 20 12:44 hadoop-maven-plugins
drwxr-xr-x. 2 root root 4096 Aug 20 12:44 hadoop-minicluster
drwxr-xr-x. 3 root root 4096 Aug 20 12:44 hadoop-project
drwxr-xr-x. 2 root root 4096 Aug 20 12:44 hadoop-project-dist
drwxr-xr-x. 18 root root 4096 Aug 20 12:44 hadoop-tools
drwxr-xr-x. 3 root root 4096 Aug 20 12:44 hadoop-yarn-project
-rw-rw-r--. 1 root root 99253 May 24 07:14 LICENSE.txt
-rw-rw-r--. 1 root root 15915 May 24 07:14 NOTICE.txt
drwxrwxr-x. 2 root root 4096 Jun 2 14:24 patchprocess
-rw-rw-r--. 1 root root 20477 May 29 06:36 pom.xml
-rw-r--r--. 1 root root 1366 May 20 13:30 README.txt
-rwxrwxr-x. 1 root root 1841 May 24 07:14 start-build-env.sh
[[email protected] hadoop-2.8.1-src]#
[[email protected] hadoop-2.8.1-src]# cat BUILDING.txt
Build instructions for Hadoop

2.JAVA安装
[[email protected] ~]# rz #上传jdk-8u45-linux-x64.gz
[[email protected] ~]# mkdir -p /usr/java
[[email protected] ~]# mv jdk-8u45-linux-x64.gz /usr/java
[[email protected] ~]# cd /usr/java
[[email protected] ~]# tar -xzvf jdk-8u45-linux-x64.gz

#修改用户和用户组
[[email protected] java]# ll
total 169388
drwxr-xr-x. 8 uucp 143 4096 Apr 11 2015 jdk1.8.0_45
-rw-r--r--. 1 root root 173271626 Mar 16 15:25 jdk-8u45-linux-x64.gz
[[email protected] java]# chown -R root:root jdk1.8.0_45
[[email protected] java]# ll
total 169388
drwxr-xr-x. 8 root root 4096 Apr 11 2015 jdk1.8.0_45
-rw-r--r--. 1 root root 173271626 Mar 16 15:25 jdk-8u45-linux-x64.gz
[[email protected] java]#

[[email protected] java]# vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_45
export PATH=$JAVA_HOME/bin:$PATH

[[email protected] java]# source /etc/profile
[[email protected] java]# which java
/usr/java/jdk1.8.0_45/bin/java
[[email protected] java]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[[email protected] java]#

3.Maven安装
[[email protected] ~]# mkdir -p /opt/sourcecode /opt/software
[[email protected] ~]# cd /opt/software/
[[email protected] software]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring apache-maven-3.3.9-bin.zip...
100% 8415 KB 8415 KB/sec 00:00:01 0 Errors

[[email protected] software]#
[[email protected] software]# ll
total 8432
-rw-r--r--. 1 root root 8617253 Aug 20 12:35 apache-maven-3.3.9-bin.zip
[[email protected] software]# unzip apache-maven-3.3.9-bin.zip

[[email protected] java]# vi /etc/profile
export MAVEN_HOME=/opt/software/apache-maven-3.3.9
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH

[[email protected] ~]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/software/apache-maven-3.3.9
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
[[email protected] ~]#

4.protobuf安装
[[email protected] software]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring protobuf-2.5.0.tar.gz...
100% 2345 KB 2345 KB/sec 00:00:01 0 Errors

[[email protected] software]#
[[email protected] software]# ll
total 10792
drwxr-xr-x. 6 root root 4096 Nov 10 2015 apache-maven-3.3.9
-rw-r--r--. 1 root root 8617253 Aug 20 12:35 apache-maven-3.3.9-bin.zip
drwxr-xr-x. 10 109965 5000 4096 Feb 27 2013 protobuf-2.5.0
-rw-r--r--. 1 root root 2401901 Aug 20 13:03 protobuf-2.5.0.tar.gz
[[email protected] software]# cd protobuf-2.5.0
[[email protected] protobuf-2.5.0]# yum install -y gcc gcc-c++ make cmake #已经安装cmake
[[email protected] protobuf-2.5.0]# ./configure --prefix=/usr/local/protobuf
[[email protected] protobuf-2.5.0]# make && make install

[[email protected] java]# vi /etc/profile
export PROTOC_HOME=/usr/local/protobuf
export PATH=$PROTOC_HOME/bin:$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
[[email protected] protobuf-2.5.0]# source /etc/profile
[[email protected] protobuf-2.5.0]# protoc --version
libprotoc 2.5.0
[[email protected] protobuf-2.5.0]#

5.Findbugs安装
[[email protected] software]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring findbugs-1.3.9.zip...
100% 7369 KB 7369 KB/sec 00:00:01 0 Errors

[[email protected] software]# unzip findbugs-1.3.9.zip

[[email protected] software]# vi /etc/profile
export FINDBUGS_HOME=/opt/software/findbugs-1.3.9
export PATH=$FINDBUGS_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
[[email protected] software]#
[[email protected] software]# source /etc/profile
[[email protected] software]# findbugs -version
1.3.9
[[email protected] software]#

6.其他依赖
yum install -y openssl openssl-devel svn ncurses-devel zlib-devel libtool
yum install -y snappy snappy-devel bzip2 bzip2-devel lzo lzo-devel lzop autoconf automake

7.编译
[[email protected] sourcecode]# cd hadoop-2.8.1-src
[[email protected] sourcecode]# mvn clean package -Pdist,native -DskipTests -Dtar

8.tar
/opt/sourcecode/hadoop-2.8.1-src/hadoop-dist/target/hadoop-2.8.1.tar.gz

提醒:
1、有时候编译过程中会出现下载某个包的时间太久,这是由于连接网站的过程中会出现假死,
此时按ctrl+c,重新运行编译命令。 可以用阿里云的地址下载jar
2、如果出现缺少了某个文件的情况,则要先清理maven(使用命令 mvn clean) 再重新编译。

时间: 2024-10-13 07:18:37

hadoop编译的相关文章

大数据技术之_03_Hadoop学习_02_入门_Hadoop运行模式+【本地运行模式+伪分布式运行模式+完全分布式运行模式(开发重点)】+Hadoop编译源码(面试重点)+常见错误及解决方案

第4章 Hadoop运行模式4.1 本地运行模式4.1.1 官方Grep案例4.1.2 官方WordCount案例4.2 伪分布式运行模式4.2.1 启动HDFS并运行MapReduce程序4.2.2 启动YARN并运行MapReduce程序4.2.3 配置历史服务器4.2.4 配置日志的聚集4.2.5 配置文件说明4.3 完全分布式运行模式(开发重点)4.3.1 虚拟机准备4.3.2 编写集群分发脚本xsync4.3.3 集群配置4.3.4 集群单点启动4.3.5 SSH无密登录配置4.3.6

CentOS中用Nexus搭建maven私服,为Hadoop编译提供本地镜像

系统: CentOS release 6.6 (Final) Nexus:nexus-2.8.1-bundle.tar.gz,下载地址:https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.8.1-bundle.tar.gz Java: java version "1.7.0_80" 创建目录并进入目录:mkdir /usr/local/nexus 解压文件:tar -zxvf nexus-2.8.1-bun

hadoop 编译自己的jar包并运行

我修从网上找了份java代码 我为了让它在hadoop下跑起来居然花了两个多小时... 首先最好不要在java代码中设置package...使用default package即可... 然后在java代码所在的文件夹下运行 javac -classpath /home/hadoop/hadoop-2.5.1/hadoop-0.20.1/hadoop-0.20.1-core.jar:/home/hadoop/hadoop-2.5.1/hadoop-0.20.1/lib/commons-cli-1.

Spark入门实战系列--2.Spark编译与部署(中)--Hadoop编译安装

[注]该系列文章以及使用到安装包/測试数据 能够在<[倾情大奉送–Spark入门实战系列] (http://blog.csdn.net/yirenboy/article/details/47291765)>获取 1 编译Hadooop 1.1 搭建好开发环境 1.1.1 安装并设置maven 1.下载maven安装包.建议安装3.0以上版本号,本次安装选择的是maven3.0.5的二进制包,下载地址例如以下 http://mirror.bit.edu.cn/apache/maven/maven

hadoop入门一(hadoop编译)

说明: hadoop版本:hadoop-2.5.0-cdh5.3.6 环境:centos6.4 必须可联网 hadoop 下载网址: http://archive.cloudera.com/cdh5/cdh/5/ 其实编译还真就是体力活,按照官方的说明,一步步往下做就可以了,不过总会遇到坑.. 编译步骤: 1.下载源码,解压,本例中解压到 /opt/softwares下: 命令: tar -zxvf hadoop-2.5.0-cdh5.3.6-src.tar.gz -C /opt/softwar

[raspberry pi3] hadoop 编译搭建和配置

Causion: 只有一个raspberry pi3的就随便玩玩吧,瓶颈不在在cpu, 1 G的内存实在是太少了,跑个hadoop就很辛苦了 下面是瞎折腾的过程: oracle的arm jdk的安装过程这边就直接略过了 1. 下载hadoop的源代码, 因为raspberry 虽然是 64bit的cpu但是实际上跑的是32 位系统, 没有能够直接使用的二进制,这边下载和编译下源代码, 以便提高下运行的效率,减少下需要的内存的量. 这边下载的版本是2.7.2, 下载完成之后解压 2. 安装下必要的

Hadoop编译源码

1.1 前期准备工作 1)CentOS联网 配置CentOS能连接外网.最好是用新克隆的虚拟机 注意:采用root角色编译,减少文件夹权限出现问题 2)jar包准备(hadoop源码.JDK8 . maven. ant .protobuf) (1)hadoop-2.7.6-src.tar.gz (2)jdk-8u144-linux-x64.tar.gz (3)apache-ant-1.9.9-bin.tar.gz (4)apache-maven-3.0.5-bin.tar.gz (5)proto

Hadoop:Windows 7 32 Bit 编译与运行

所需工具 1.Windows 7 32 Bit OS(你懂的) 2.Apache Hadoop 2.2.0-bin(hadoop-2.2.0.tar.gz) 3.Apache Hadoop 2.2.0-src(hadoop-2.2.0-src.tar.gz) 3.JDK 1.7 4.Maven 3.2.1(apache-maven-3.2.1-bin.zip) 5.Protocol Buffers 2.5.0 6.Unix command-line tool Cygwin(Setup-x86.e

CentOS 64位上编译 Hadoop 2.6.0

1.操作系统编译环境 yum install cmake lzo-devel zlib-devel gcc gcc-c++ autoconf automake libtool ncurses-devel openssl-devel libXtst 2.安装JDK 下载JDK1.7,注意只能用1.7,否则编译会出错 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html tar zxvf