标签:
1. 访问hadoop官网下载hadoop-2.7.1-src.tar.gz
tar -zxvf hadoop-2.7.1-src.tar.gz cd hadoop-2.7.1-src vi BUILDING.txt
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 ) * Jansson C XML parsing library ( if compiling libwebhdfs ) * 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)
2. 安装java1.8.0_60
下载jdk-8u60-linux-x64.tar.gz,解压后移动到/opt目录下
tar -zxvf jdk-8u60-linux-x64.tar.gz mv jdk1.8.0_60 /opt
然后打开/etc/profile配置jdk环境变量
vim /etc/profile
按 i 进入插入模式,在文件末尾添加
export JAVA_HOME=/opt/jdk1.8.0_60 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin export JRE_HOME=/opt/jdk1.8.0_60/jre export PATH=$PATH:$JRE_HOME/bin
先后按Esc, Shift+:, wq, 回车即可保存并退出编辑。<br>输入 source /etc/profile 回车即可保存更改。
运行javac -version 查看状态:
[root@hadoop1 opt]# java -version java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
3. 安装相关类库
yum -y install svn ncurses-devel gcc* yum -y install lzo-devel zlib-devel autoconf automake libtool cmake openssl-devel
4. 安装protobuf-2.5.0.tar.gz(注意版本必须是2.5.0)
下载protobuf-2.5.0.tar.gz
tar zxvf protobuf-2.5.0.tar.gz
进入protobuf-2.5.0依次执行
cd protobuf-2.5.0 ./configure make make install
验证安装是否完成
[root@hadoop1 protobuf-2.5.0]# protoc --version libprotoc 2.5.0
5. 安装maven
下载apache-maven-3.2.2-bin.tar.gz
tar -zxvf apache-maven-3.2.2-bin.tar.gz mv apache-maven-3.2.2 /opt
配置环境变量:
vi /etc/profile
在文件尾部追加
export MAVEN_HOME=/opt/apache-maven-3.2.2 export MAVEN_OPTS="-Xms256m -Xmx512m" export PATH=$PATH:$MAVEN_HOME/bin
使/etc/profile生效
source /etc/profile
查看安装状态
mvn -version [root@hadoop1 ~]# mvn -version Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T21:51:42+08:00) Maven home: /opt/apache-maven-3.2.2 Java version: 1.8.0_60, vendor: Oracle Corporation Java home: /opt/jdk1.8.0_60/jre Default locale: zh_CN, platform encoding: GB18030 OS name: "linux", version: "3.10.0-229.14.1.el7.x86_64", arch: "amd64", family: "unix"
6. 安装ant
下载apache-ant-1.9.4-bin.tar.gz 后解压
tar -zxvf apache-ant-1.9.4-bin.tar.gz
移动到/opt目录下
mv apache-ant-1.9.4 /opt
配置环境变量
vi /etc/profile
在文件尾部追加
export ANT_HOME=/opt/apache-ant-1.9.4 export PATH=$PATH:$ANT_HOME/bin
使更改生效
source /etc/profile
查看安装结果
[root@hadoop1 ~]# ant -version Apache Ant(TM) version 1.9.4 compiled on April 29 2014
7. 安装findbugs
下载findbugs-3.0.1.tar.gz解压缩
tar -zxvf findbugs-3.0.1.tar.gz
移动到/opt目录下
mv findbugs-3.0.1 /opt
配置环境变量
[root@hadoop1 ~]# vi /etc/profile export FINDBUGS_HOME=/opt/findbugs-3.0.1 export PATH=$PATH:$FINDBUGS_HOME/bin
使更改生效
[root@hadoop1 ~]# source /etc/profile
查看安装结果
[root@hadoop1 ~]# findbugs -version 3.0.1
8. 编译hadoop-2.7.1-src
[root@hadoop1 ~]# cd hadoop-2.7.1-src [root@hadoop1 hadoop-2.7.1-src]# mvn clean package -Pdist,native -DskipTests -Dtar
标签:
原文地址:http://my.oschina.net/ordinance/blog/521931