Hadoop开篇,按惯例。先编译源代码。导入到Eclipse。这样以后要了解那块,或者那块出问题了。直接找源代码。

编译hadoop2.4.1源代码之前。必须安装Maven和Ant环境,而且Hadoop须要protoc2.5.0的支持,所以还要下载protoc。我下载的是:protobuf-2.5.0.tar.bz2

对protoc进行编译安装前先要装几个依赖包:gcc,gcc-c++,make 假设已经安装的能够忽略

yum install gcc
yum install gcc-c++
yum install make
yum install cmake
yum install openssl-devel
yum install ncurses-devel

安装protoc

tar -xvf protobuf-2.5.0.tar.bz2
cd protobuf-2.5.0
./configure --prefix=/opt/protoc/
make && make install

linux系统运行编译命令:mvn install eclipse:eclipse -Pdist,native -DskipTests -Dtar -Dmaven.javadoc.skip=true



编译完毕后。查看hadoop-dist目录:

[root@localhost target]# ll
total 153824
drwxr-xr-x. 2 root root 4096 Jul 9 17:00 antrun
-rw-r--r--. 1 root root 4809 Jul 9 17:00 dist-layout-stitching.sh
-rw-r--r--. 1 root root 666 Jul 9 17:01 dist-tar-stitching.sh
drwxr-xr-x. 9 root root 4096 Jul 9 17:00 hadoop-3.0.0-SNAPSHOT
-rw-r--r--. 1 root root 157482988 Jul 9 17:01 hadoop-3.0.0-SNAPSHOT.tar.gz
-rw-r--r--. 1 root root 3445 Jul 9 17:01 hadoop-dist-3.0.0-SNAPSHOT.jar
drwxr-xr-x. 2 root root 4096 Jul 9 17:01 maven-archiver
drwxr-xr-x. 2 root root 4096 Jul 9 17:00 test-dir
[root@localhost target]# pwd
/home/fish/hadoop/hadoop-dist/target

查看hadoop的版本号:
[root@localhost bin]# cd /home/fish/hadoop/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT/bin
[root@localhost bin]# ./hadoop version
Hadoop 3.0.0-SNAPSHOT
Source code repository https://github.com/apache/hadoop.git -r e0febce0e74ec69597376774f771da46834c42b1
Compiled by root on 2015-07-09T08:53Z
Compiled with protoc 2.5.0
From source with checksum d69dd13fde158d22d95a263a0f12bc8
This command was run using /home/fish/hadoop/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT/share/hadoop/common/hadoop-common-3.0.0-SNAPSHOT.jar
[root@localhost bin]# pwd
/home/fish/hadoop/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT/bin

查看编译的一些信息:

[root@localhost hadoop-3.0.0-SNAPSHOT]# file lib//native/*
lib//native/libhadoop.a: current ar archive
lib//native/libhadooppipes.a: current ar archive
lib//native/libhadoop.so: symbolic link to `libhadoop.so.1.0.0'
lib//native/libhadoop.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
lib//native/libhadooputils.a: current ar archive
lib//native/libhdfs.a: current ar archive
lib//native/libhdfs.so: symbolic link to `libhdfs.so.0.0.0'
lib//native/libhdfs.so.0.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
lib//native/libnativetask.a: current ar archive
lib//native/libnativetask.so: symbolic link to `libnativetask.so.1.0.0'
lib//native/libnativetask.so.1.0.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
[root@localhost hadoop-3.0.0-SNAPSHOT]# pwd
/home/fish/hadoop/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT

编译问题

问题1:

[ERROR] Failed to execute goal on project hadoop-common: Could not resolve dependencies for project org.apache.hadoop:hadoop-common:jar:3.0.0-SNAPSHOT: Failure to find org.apache.hadoop:hadoop-auth:jar:tests:3.0.0-SNAPSHOT in http
://10.0.1.88:8081/nexus/content/repositories/thirdparty/ was cached in the local repository, resolution will not be reattempted until the update interval of thirdparty has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-common

改动.m2中的文件:

mv /root/.m2/repository/org/apache/hadoop/hadoop-auth/3.0.0-SNAPSHOT/hadoop-auth-3.0.0-SNAPSHOT-tests.jar.lastUpdated /root/.m2/repository/org/apache/hadoop/hadoop-auth/3.0.0-SNAPSHOT/hadoop-auth-3.0.0-SNAPSHOT-tests.jar
mv /root/.m2/repository/org/apache/hadoop/hadoop-kms/3.0.0-SNAPSHOT/hadoop-kms-3.0.0-SNAPSHOT-tests.jar.lastUpdated /root/.m2/repository/org/apache/hadoop/hadoop-kms/3.0.0-SNAPSHOT/hadoop-kms-3.0.0-SNAPSHOT-tests.jar
mv /root/.m2/repository/org/apache/hadoop/hadoop-hdfs/3.0.0-SNAPSHOT/hadoop-hdfs-3.0.0-SNAPSHOT-tests.jar.lastUpdated /root/.m2/repository/org/apache/hadoop/hadoop-hdfs/3.0.0-SNAPSHOT/hadoop-hdfs-3.0.0-SNAPSHOT-tests.jar

问题2:

还有些错误会报无法下载到jar,这样的情况能够登录到http://search.maven.org/官方库去看下这个包存不存在,假设存在的话,可能是由于网络原因,多运行几次就能够了。

问题3:

[root@localhost bin]# ./hadoop
: No such file or directory

改动hadoop命令为linux的格式:

dos2unix /home/fish/hadoop/hadoop-dist/target/hadoop-3.0.0-SNAPSHOT/bin/hadoop

Hadoop之Linux源代码编译的更多相关文章

  1. linux源代码编译安装OpenCV

    为了尽可能保证OpenCV的特性,使用OpenCV源代码编译安装在linux上.先从安装其依赖项開始,以ubuntu 14.04.X为例解说在Linux上源代码编译安装OpenCV,其它linux版本 ...

  2. SUSE Linux源代码编译安装MySQL 5.6

    这篇文章主要介绍了SUSE Linux下源代码编译方式安装MySQL 5.6过程分享,本文使用SUSE Linux Enterprise Server 10 SP3 (x86_64)系统,须要的朋友能 ...

  3. Linux源代码编译安装tree命令

    wget ftp://mama.indstate.edu/linux/tree/tree-1.6.0.tgz .tgz cd tree- make && make install

  4. Linux下编译VLC for Android源代码总结

    转:http://blog.chinaunix.net/uid-26611383-id-3678766.html 由于项目需要,需要一个在android平台能够支持RTSP协议的播放器,由于之前没有a ...

  5. Linux 环境中从源代码编译安装 ReText 问题与解决

    从源代码编译安装 ReText 问题与解决 1. 如何安装 Python Markups 1.1 从 https://launchpad.net/python-markups 下载 Python Ma ...

  6. Hadoop2.x介绍与源代码编译

    1.Hadoop 项目的四大模块 Hadoop Common: The common utilities that support the other Hadoop modules. Hadoop D ...

  7. 在Linux上编译Hadoop-2.4.0

    目录 目录 1 1. 前言 1 2. 安装依赖 1 2.1. 安装ProtocolBuffer 2 2.2. 安装CMake 2 2.3. 安装JDK 2 2.4. 安装Maven 3 3. 编译Ha ...

  8. Win7 32bit下一个hadoop2.5.1源代码编译平台的搭建各种错误遇到

    从小白在安装hadoop困难和错误时遇到说起,同时,我们也希望能得到上帝的指示. 首先hadoop更新速度非常快,最新的是hadoop2.5.1,因此就介绍下在安装2.5.1时遇到的各种困难. 假设直 ...

  9. 源代码编译安装Python3.5.2

    由于没有找到Python3.5的rpm安装包,因此进行源代码编译安装 1.下载Python3.5.2 [root@seastar ~]# cd /usr/local/src [root@seastar ...

随机推荐

  1. Linux下测试SSD固态硬盘写入速度

    最近买了一个256GB的SSD固态硬盘,想测试一下写入速度,于是如下操作. 部分代码: gettimeofday(&start, NULL); int fd = open("test ...

  2. web自动化测试:watir+minitest(二)

    环境搭建: 我已经安装了一台全新的win7虚拟机.下面将开始搭建watir环境. 安装包清单. 安装ruby.执行rubyinstaller-2.2.4-x64.exe 选择语言: 勾选添加到环境变量 ...

  3. PHP共享内存的应用shmop系列

    简单的说明 可能很少情况会使用PHP来操控共享内存,一方面在内存的控制上,MC已经提供了一套很好的方式,另一方面,自己来操控内存的难度较大,内存的读写与转存,包括后面可能会用到的存储策略,要是没有一定 ...

  4. Python flask几个小问题

    1.这句是个重定向,如果sse_id为空,定向到StudentScoreCenter()这个函数返回的uURL中(就是回到学生分数中心). 2.g是flask一个固定的用法,用来存登陆信息的,你可以简 ...

  5. 【bzoj3280】小R的烦恼 费用流

    题目描述 小R最近遇上了大麻烦,他的程序设计挂科了.于是他只好找程设老师求情.善良的程设老师答应不挂他,但是要求小R帮助他一起解决一个难题. 问题是这样的,程设老师最近要进行一项邪恶的实验来证明P=N ...

  6. ZOJ 2676 Network Wars(最优比例最小割)

    Network Wars Time Limit: 5 Seconds      Memory Limit: 32768 KB      Special Judge Network of Bytelan ...

  7. 【POJ3693】Maximum repetition substring (SA)

    这是一道神奇的题目..论文里面说得不清楚,其实是这样...如果一个长度为l的串重复多次,那么至少s[1],s[l+1],s[2*l+1],..之中有相邻2个相等...设这时为j=i*l+1,k=j+l ...

  8. drools6

    <dependency> <groupId>org.drools</groupId> <artifactId>drools-core</artif ...

  9. 座位安排(seat)

    座位安排(seat) 题目描述 费了一番口舌,wfj_2048终于成功地说服了n∗mn∗m个妹子来陪自己看电影. 为了这次声势浩大,wfj_2048包下了一座有n∗mn∗m个座位的电影院. (wfj_ ...

  10. bzoj2438 杀人游戏 Tarjan强联通

    [bzoj2438][中山市选2011]杀人游戏 Description 一位冷血的杀手潜入 Na-wiat,并假装成平民.警察希望能在 N 个人里面,查出谁是杀手.警察能够对每一个人进行查证,假如查 ...