编译Hadoop2.7.1(Ubuntu)

操作系统准备:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential openjdk-7-jdk git maven subversion
$ sudo apt-get install g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev

$ java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.6) (7u51-2.4.6-1ubuntu4)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
$ update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
$ git --version
git version 1.9.1
$ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-24-generic", arch: "amd64", family: "unix"
$ apt-cache policy protobuf-compiler
protobuf-compiler:
  Installed: (none)
  Candidate: 2.5.0-9ubuntu1
  Version table:
     2.5.0-9ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
$ sudo apt-get install protobuf-compiler
$ protoc --version
libprotoc 2.5.0

编译:

$ git clone --branch release-2.4.0 https://github.com/apache/hadoop-common
$ cd hadoop-common
$ mvn package -Pdist,native -DskipTests -Dtar
$ file hadoop-dist/target/hadoop-2.4.0/lib/native/*
$ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
$ hadoop-dist/target/hadoop-2.4.0/bin/hadoop version
Hadoop 2.4.0
Subversion https://github.com/apache/hadoop-common -r 23f5c...
Compiled with protoc 2.5.0

你可能感兴趣的:(hadoop,ubuntu)