Hadoop源码编译-hadoop-2.0.3-alpha-Linux-CentOS

操作系统:CentOs

1.安装JDK、Maven并设置环境变量

a) JDK安装配置过程省略

b) Maven安装配置过程

下载地址:http://labs.mop.com/apache-mirror/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz

解压即可,并设置MAVEN_HOME,将$MAVEN_HOME/bin 加入PATH

设置本地仓库路径:$MAVEN_HOME/conf/setting.xml

< localRepository >/runtu/repo</ localRepository >

 

代理上网的话需要设置:$MAVEN_HOME/conf/setting.xml

< proxies >
   < proxy >
     < id >optional</ id >
     < active >true</ active >
     < protocol >http</ protocol >
     < host >192.168.0.1</ host >
     < port >80</ port >
     < nonProxyHosts >local.net|some.host.com</ nonProxyHosts >
   </ proxy >
</ proxies >

 

2.安装protobuf

   下载地址:http://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.4.1.tar.gz&can=2&q=
   安装过程:
tar zxvf protobuf-2.4.1. tar .gz
cd protobuf-2.4.1
. /configure
make
make check
make install
   查看是否安装成功:protoc --version

3.下载Hadooop源码。
  源码包地址:http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.0.3-alpha/hadoop-2.0.3-alpha-src.tar.gz
  Svn:http://svn.apache.org/repos/asf/hadoop/common/tags/release-2.0.3-alpha/

4.源码编译脚本:
Create binary distribution without native code and without documentation:

   $ mvn package -Pdist -DskipTests -Dtar

Create binary distribution with native code and with documentation:

   $ mvn package -Pdist,native,docs -DskipTests -Dtar

Create source distribution:

   $ mvn package -Psrc -DskipTests

Create source and binary distributions with native code and documentation:

   $ mvn package -Pdist,native,docs,src -DskipTests -Dtar

Create a local staging version of the website ( in /tmp/hadoop-site )

   $ mvn clean site; mvn site:stage -DstagingDirectory= /tmp/hadoop-site

注意:

使用代理上网增加配置:  -Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=80

如: $ mvn package -Pdist -DskipTests -Dtar -Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=80

你可能感兴趣的:(Hadoop源码编译-hadoop-2.0.3-alpha-Linux-CentOS)