今天来说说编译hadoop源码的事情吧~ 1、首先下载源码 地址:http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.4.0/
2、加压tar包到指定文件夹:/home/hadoop/soft/hadoop
1. tar zxvf hadoop- 2.4 . 0 -src.tar.gz 3、Linux编译环境准备
java环境准备 参照:http://blog.csdn.net/enson16855/article/details/8708574 maven环境 下载地址:http://maven.apache.org/download.cgi 解压到指定文件夹:/home/hadoop/soft/ 配置maven本地仓库,编辑maven下 conf/settings.xml文件 1. <localRepository>/home/hadoop/soft/repo</localRepository> ant环境 下载地址:http://ant.apache.org/bindownload.cgi 以上maven,JDK,ant的配置如下: root用户下面编辑/etc/profile 命令如下: 1. vim /etc/profile 01. export JAVA_HOME=/usr/java/jdk1. 7 .0_60 02. export PATH= "$JAVA_HOME/bin:$PATH" 03. 04. export MAVEN_HOME=/home/hadoop/soft/apache-maven- 3.2 . 1 05. export PATH= "$MAVEN_HOME/bin:$PATH" 06. 07. export ANT_HOME=/home/hadoop/soft/apache-ant- 1.9 . 4 08. export PATH= "$ANT_HOME/bin:$PATH" 09. 10. export HADOOP_PREFIX=/home/hadoop/soft/hadoop/hadoop- 2.4 . 0 11. export CLASSPATH= ".:$JAVA_HOME/lib:$CLASSPATH" 12. export PATH= "$JAVA_HOME/:$HADOOP_PREFIX/bin:$PATH" 13. export HADOOP_PREFIX PATH CLASSPATH 采用yum方式安装,yum配置参照:http://blog.csdn.net/enson16855/article/details/9140623 命令如下:root用户哦~ 1. yum install openssl 与openssl的安装一样,采用yum安装: 1. yum install cmake 下载: 1. wget https: //protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz 下载完成解压: 1. tar zxvf protobuf- 2.5 . 0 .tar.gz 1. sudo ./configure 2. sudo make 3. sudo make check 4. sudo make install 5. sudo ldconfig 1. mvn package -Pdist, native -DskipTests -Dtar 进到~/hadoop-2.4.0-src/hadoop-dist/target文件夹中有: |