ubuntu 12.04 64位系统下hadoop-2.2.0-src源码编译

第零:配置yum源
     yum install gcc  
     yum install gcc-c++  
     yum install make  
     yum install cmake   
     yum install openssl-devel    
     yum install ncurses-devel  
第一:安装JDK1.7.0_45及配置环境变量
第二:安装Apache Maven 3.2.1及配置环境变量
第三:安装ProtoclBuffer及配置环境变量 protobuf-2.5.0.tar.gz
第四:设置maven仓库 vim /usr/local/maven/conf/settings.xml
     <localRepository>/opt/hn/mavenRep</localRepository>
第五:如果公司设置代理, 配置代理
     <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.xxx</host>
      <port>8888</port>
    </proxy>
第六:安装cmake及配置环境变量  cmake-2.8.12.2.tar.gz 
环境变量:
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

#protobuf
export PROTOC_HOME=/usr/local/protobuf
export PATH=$PROTOC_HOME/bin/:$PATH

#cmake
export CMAKE_HOME=/usr/local/cmake
export PATH=$CMAKE_HOME/bin/:$PATH

#maven
export MAVEN_HOME=/usr/local/maven
export CLASSPATH=.:$CLASSPATH:$MAVEN_HOME/lib
export PATH=$MAVEN_HOME/bin:$PATH

第七:下载hadoop 2.2.0源码并编译
     http://www.us.apache.org/dist/hadoop/common/hadoop-2.2.0/hadoop-2.2.0-src.tar.gz
     拷贝到/opt/somedir/目录下解压
     tar -xvf hadoop-2.2.0-src.tar.gz
第八:进入hadoop-2.2.0-src目录进行编译
      mvn package -DskipTests -Pdist,native

结果:
[INFO] 
[INFO] Apache Hadoop Main ................................ SUCCESS [03:42 min]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [02:02 min]
[INFO] Apache Hadoop Annotations ......................... SUCCESS [01:18 min]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [  0.411 s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [02:00 min]
[INFO] Apache Hadoop Maven Plugins ....................... SUCCESS [01:54 min]
[INFO] Apache Hadoop Auth ................................ SUCCESS [01:01 min]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS [ 37.663 s]
[INFO] Apache Hadoop Common .............................. SUCCESS [06:57 min]
[INFO] Apache Hadoop NFS ................................. SUCCESS [ 32.817 s]
[INFO] Apache Hadoop Common Project ...................... SUCCESS [  0.126 s]
[INFO] Apache Hadoop HDFS ................................ SUCCESS [05:16 min]
[INFO] Apache Hadoop HttpFS .............................. SUCCESS [ 35.309 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SUCCESS [01:22 min]
[INFO] Apache Hadoop HDFS-NFS ............................ SUCCESS [  7.400 s]
[INFO] Apache Hadoop HDFS Project ........................ SUCCESS [  0.139 s]
[INFO] hadoop-yarn ....................................... SUCCESS [01:42 min]
[INFO] hadoop-yarn-api ................................... SUCCESS [01:05 min]
[INFO] hadoop-yarn-common ................................ SUCCESS [ 43.943 s]
[INFO] hadoop-yarn-server ................................ SUCCESS [  0.260 s]
[INFO] hadoop-yarn-server-common ......................... SUCCESS [ 16.507 s]
[INFO] hadoop-yarn-server-nodemanager .................... SUCCESS [ 27.990 s]
[INFO] hadoop-yarn-server-web-proxy ...................... SUCCESS [  4.840 s]
[INFO] hadoop-yarn-server-resourcemanager ................ SUCCESS [ 22.708 s]
[INFO] hadoop-yarn-server-tests .......................... SUCCESS [  0.852 s]
[INFO] hadoop-yarn-client ................................ SUCCESS [  8.471 s]
[INFO] hadoop-yarn-applications .......................... SUCCESS [  0.155 s]
[INFO] hadoop-yarn-applications-distributedshell ......... SUCCESS [  4.961 s]
[INFO] hadoop-mapreduce-client ........................... SUCCESS [  0.189 s]
[INFO] hadoop-mapreduce-client-core ...................... SUCCESS [ 38.164 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher .... SUCCESS [  4.214 s]
[INFO] hadoop-yarn-site .................................. SUCCESS [  0.247 s]
[INFO] hadoop-yarn-project ............................... SUCCESS [ 46.761 s]
[INFO] hadoop-mapreduce-client-common .................... SUCCESS [ 27.332 s]
[INFO] hadoop-mapreduce-client-shuffle ................... SUCCESS [  4.649 s]
[INFO] hadoop-mapreduce-client-app ....................... SUCCESS [ 17.359 s]
[INFO] hadoop-mapreduce-client-hs ........................ SUCCESS [  7.947 s]
[INFO] hadoop-mapreduce-client-jobclient ................. SUCCESS [ 10.620 s]
[INFO] hadoop-mapreduce-client-hs-plugins ................ SUCCESS [  3.098 s]
[INFO] Apache Hadoop MapReduce Examples .................. SUCCESS [  9.794 s]
[INFO] hadoop-mapreduce .................................. SUCCESS [  3.233 s]
[INFO] Apache Hadoop MapReduce Streaming ................. SUCCESS [  7.550 s]
[INFO] Apache Hadoop Distributed Copy .................... SUCCESS [01:39 min]
[INFO] Apache Hadoop Archives ............................ SUCCESS [  3.829 s]
[INFO] Apache Hadoop Rumen ............................... SUCCESS [ 11.053 s]
[INFO] Apache Hadoop Gridmix ............................. SUCCESS [  7.880 s]
[INFO] Apache Hadoop Data Join ........................... SUCCESS [  4.962 s]
[INFO] Apache Hadoop Extras .............................. SUCCESS [  4.782 s]
[INFO] Apache Hadoop Pipes ............................... SUCCESS [ 15.062 s]
[INFO] Apache Hadoop Tools Dist .......................... SUCCESS [  2.020 s]
[INFO] Apache Hadoop Tools ............................... SUCCESS [  0.042 s]
[INFO] Apache Hadoop Distribution ........................ SUCCESS [ 20.225 s]
[INFO] Apache Hadoop Client .............................. SUCCESS [  5.991 s]
[INFO] Apache Hadoop Mini-Cluster ........................ SUCCESS [  0.216 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38:27 min
[INFO] Finished at: 2014-05-20T23:45:29+08:00
[INFO] Final Memory: 99M/382M
[INFO] ------------------------------------------------------------------------
hadoop@hadoopMaster:/opt/hn/hadoop_family/hadoop-2.2.0-src$
第九: 版本验证
    hadoop@hadoopMaster:/opt/hn/hadoop_family/hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/bin$ ./hadoop version
Hadoop 2.4.0
Subversion Unknown -r Unknown
Compiled by root on 2014-05-06T08:19Z
Compiled with protoc 2.5.0
From source with checksum 375b2832a6641759c6eaf6e3e998147
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.4.0.jar

你可能感兴趣的:(ubuntu 12.04)