当前位置:Gxlcms > mysql > Hadoop2.x在Ubuntu系统中编译源码

Hadoop2.x在Ubuntu系统中编译源码

时间:2021-07-01 10:21:17 帮助过:39人阅读

本文主要记录Hadoop2.x在Ubuntu 12.04下编译源码的主要步骤和注意点: [一]、基础环境 Ubuntu 12.04 LTS 64? 位 Hadoop2.2.0 Java version: 1.7.0_55 Apache Maven 3.2.1 [二]、软件配置 1、更新apt 源 vi /et/apt/sources.list ,在文件末增加如下国内访

本文主要记录Hadoop2.x在Ubuntu 12.04下编译源码的主要步骤和注意点: [一]、基础环境
  • Ubuntu 12.04 LTS 64? 位
  • Hadoop2.2.0
  • Java version: 1.7.0_55
  • Apache Maven 3.2.1
[二]、软件配置 1、更新apt 源 vi /et/apt/sources.list ,在文件末增加如下国内访问比较快的源:
# 163 源 
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
# 中科大
deb http://mirrors.ustc.edu.cn/ubuntu/ precise-updates main restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise-updates main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/ precise universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise universe
deb http://mirrors.ustc.edu.cn/ubuntu/ precise-updates universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu/ precise multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ precise-updates multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
# added by  micmiu.com
保存修改后执行:
sudo apt-get update
sudo apt-get upgrade
2、安装编译需要的第三方软件:
#一次安装全部依赖的软件 
sudo apt-get install g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
3、编译安装:protobuf 去官网下载:http://code.google.com/p/protobuf/downloads/list (目前 2.5.0版本),然后解压编译安装:
tar xzf protobuf-2.5.0.tar.gz 
cd protobuf-2.5.0/
./configure --prefix=/usr
make check
make install
安装完成后验证下:
micmiu@ubuntu:~$ protoc --version
libprotoc 2.5.0
ps:默认情况下,protobuf 包会被安装在/usr/local路径下。但是,在某些系统平台上(如Ubuntu 12),/usr/local/lib 路径并不包含在LD_LIBRARY_PATH 中。当然你亦可手动添加,但是一般的做法是configure命令指定参数 prefix./configure --prefix=/usr [三]、Hadoop编译 下载源码:
svn co https://svn.apache.org/repos/asf/hadoop/common/tags/release-2.2.0 hadoop-release-2.2.0
ps: hadoop2.2.0的源码有个bug :修改 <源码跟目录>/hadoop-common-project/hadoop-auth/pom.xml中添加如下依赖:
    org.mortbay.jetty
    jetty-util
    test
然后执行编译命令:
cd hadoop-release-2.2.0
mvn package -Pdist,native -DskipTests -Dtar
编译成功后,可以在目录 hadoop-dist/target 下找到相关的发布包。 —————– ?EOF?@Michael Sun?—————–

人气教程排行