编译 hadoop 2.2.0 解决 WARN util.NativeCodeLoader: Unable to load native-hadoop library

编译 hadoop 2.2.0 解决 WARN util.NativeCodeLoader: Unable to load native-hadoop library

maven安装

[andy@s41 ~]$ wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz

解压后放到/usr/local目录下。

增加国内maven 开源中国镜像

[andy@s41 ~]$ sudo vi /usr/local/apache-maven-3.1.1/conf/settings.xml


nexus-osc
*
Nexus osc
http://maven.oschina.net/content/groups/public/

下载安装hadoop2.2

[andy@s41 ~]$ wget http://mirrors.cnnic.cn/apache/hadoop/common/stable2/hadoop-2.2.0-src.tar.gz

[andy@s41 ~]$ cd hadoop-2.2.0-src
[andy@s41 hadoop-2.2.0-src]$

安装编译protobuf

[andy@s41 ~]$ wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2

[andy@s41 ~]$ tar jxvf protobuf-2.5.0.tar.bz2

[andy@s41 protobuf-2.5.0]$ ./configure

[andy@s41 protobuf-2.5.0]$ make
[andy@s41 protobuf-2.5.0]$ make install

编译

[andy@s41 hadoop-2.2.0-src]$ mvn install -DskipTests

编译完了在这里hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/lib
拷贝到我们的hadoop 中 搞定。