在ubuntu16.06 64位上編譯hadoop2.7.5

首先要下載hadoop源碼包,並放在linux目錄中進行解壓。解壓後能夠看到文件目錄的結構:linux

leiline@master:~/Documents/CompileHadoop/hadoop-2.7.5-src$ ll
total 220
drwxr-xr-x 19 leiline leiline  4096 12月 16 07:26 ./
drwxrwxr-x  3 leiline leiline  4096 1月   7 15:16 ../
-rw-r--r--  1 leiline leiline 13050 12月 16 04:02 BUILDING.txt
drwx------  3 leiline leiline  4096 1月   7 15:16 dev-support/
drwx------  4 leiline leiline  4096 1月   7 15:16 hadoop-assemblies/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-build-tools/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-client/
drwxr-xr-x  9 leiline leiline  4096 12月 16 04:02 hadoop-client-modules/
drwxr-xr-x  3 leiline leiline  4096 12月 16 04:02 hadoop-cloud-storage-project/
drwx------ 10 leiline leiline  4096 1月   7 15:16 hadoop-common-project/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-dist/
drwx------  8 leiline leiline  4096 1月   7 15:16 hadoop-hdfs-project/
drwx------  9 leiline leiline  4096 1月   7 15:16 hadoop-mapreduce-project/
drwx------  4 leiline leiline  4096 1月   7 15:16 hadoop-maven-plugins/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-minicluster/
drwx------  4 leiline leiline  4096 1月   7 15:16 hadoop-project/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-project-dist/
drwx------ 21 leiline leiline  4096 1月   7 15:16 hadoop-tools/
drwx------  3 leiline leiline  4096 1月   7 15:16 hadoop-yarn-project/
-rw-r--r--  1 leiline leiline 86424 12月 16 04:02 LICENSE.txt
-rw-r--r--  1 leiline leiline 14978 12月 16 04:02 NOTICE.txt
-rw-r--r--  1 leiline leiline 18993 12月 16 06:53 pom.xml
-rw-r--r--  1 leiline leiline  1366 7月  25 09:19 README.txt
drwxrwxr-x  2 leiline leiline  4096 1月   7 15:16 .settings/

在BUILDING.txt文件中有對編譯的要求。maven

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. 安裝依賴

* Maven
  $ sudo apt-get -y install maven
* Native libraries
  $ sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
* ProtocolBuffer 2.5.0 (required)
  $ sudo apt-get -y install libprotobuf-dev protobuf-compiler

2. 編譯hadoop

進入hadoop source src目錄oop

mvn package -Pdist,native -DskipTests -Dtar

編譯好的二進制包在以下目錄:fetch

hadoop-2.7.5-src/hadoop-dist/target/
相關文章
相關標籤/搜索