1. jdk1.7 此处省略二百字
2. maven 3.2.1 安装
#wget http://apache.communilink.net/maven/maven-3/3.2.1/binaries/apache-maven-3.2.1-bin.tar.gz
#tar xf apache-maven-3.2.1-bin.tar.gz
#mv apache-maven-3.2.1-bin /usr/local/maven-3.2.1
#vim ~/.bashrc添加
export PATH=/usr/local/maven-3.2.1/bin:$PATH
#source ~/.bashrc
验证安装:#mvn -version
3. 安装protobuf
$wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
./configure
#make && make install
$protoc --version
protoc: error while loading shared libraries: libprotobuf.so.8: cannot open shared object file: No such file or directory
$sudo cp -rp protobuf-2.5.0/src/.libs/libproto* /usr/lib64/
$ldconfig
再次验证:
$protoc --version
4. 安装CMake、openssl 和 ncurses
要求CMake 2.6+
sudo yum install -y cmake
sudo yum install openssl-devel
sudo yum install -y ncurses-devel
5. 下载hadoop源码和编译
#wget http://mirror.bit.edu.cn/apache/hadoop/common/stable2/hadoop-2.6.0-src.tar.gz
http://mirrors.hust.edu.cn/apache/hadoop/common/stable/hadoop-2.6.0-src.tar.gz
解压 #tar zxf hadoop-2.6.0-src.tar.gz
找到 hadoop-common-project/hadoop-auth/pom.xml
查看jetty,确保有下面项目
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
执行
#mvn package -DskipTests -Pdist,native
请确保网络畅通。maven这玩意儿会不停Downloading很多东西,TMD。
如果出错,请耐心调整和等待,直到出现
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36:11 min
完成后应该看到sbin之类的在目录:
hadoop-2.6.0-src/hadoop-dist/target/hadoop-2.6.0/
亲测已OK, Good Luck!