一、安装所需要的工具
a) 下载hadoop源码 (当前最新的稳定版是2.7.4)
地址 http://mirrors.hust.edu.cn/apache/hadoop/common/stable/hadoop-2.7.4-src.tar.gz
b) 下载并解压apache-ant (centos自带的ant版本太低,编译过程中会报错)
地址: http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.10.1-bin.zip (最新版本即可)
c) 下载并解压protobuf-2.5.0.tar.gz (这是google出品的一个数据传输格式)
地址: https://developers.google.com/protocol-buffers/docs/downloads (官网地址要翻!墙!,百度上也能找到国内下载地址)
d) 下载并解压findbugs
地址: http://prdownloads.sourceforge.NET/findbugs/findbugs-3.0.1.tar.gz?download (最新版本即可)
e) 下载并解压maven
地址: http://maven.apache.org/download.cgi (下载最新版即可,本文中用的是3.5.0)
f) 下载并安装jdk,使用sudo安装
地址:这个比较容易找,大家自己去Oracle官网找着,jdk1.8 及以上(本文用的是1.8.111)
二、设置环境变量
vi ~/.bash_profile,添加以下命令:
export ANT_HOME=/home/myusr/apache-ant-1.10.1
export FINDBUGS_HOME=/home/myusr/findbugs-3.0.1
export JAVA_HOME=/usr/java/jdk1.8.0_111/
export M2_HOME=/home/myusr/apache-maven-3.5.0
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin:$ANT_HOME/bin:$FINDBUGS_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source ~/.bash_profile
三、设置maven的本地存储库(高亮显示)
<settings xmlns=" http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 直接网络下载的话,只修改这句就可以 -->
<localRepository> /home/myusr/apache-maven-3.5.0/repo</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url> http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url> http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url> http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>