CentOS64位上編譯Hadoop2.6.0
由於hadoop-2.6.0.tar.gz安裝包是在32位機器上編譯的,64位的機器載入本地庫.so檔案時會出錯,比如:
java.lang.UnsatisfiedLinkError: org.apache.hadoop.util.NativeCrc32.nativeComputeChunkedSumsByteArray(II[BI[BIILjava/lang/String;JZ)V
所以需要重新編譯
1.編譯環境
yum install cmake lzo-devel zlib-devel gcc gcc-c++ autoconf automake libtool ncurses-devel openssl-devel libXtst
2.安裝JDK(下載JDK1.7,只能用1.7,否則編譯會出錯)
下載頁面: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tar -zxvf jdk-7u75-linux-x64.tar.gz -C /usr/local
export JAVA_HOME=/usr/local/jdk1.7.0_75
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
3.安裝protobuf
下載protobuf-2.5.0,不能用高版本,否則Hadoop編譯不能通過
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz 或者 在百度雲盤上下載:http://yun.baidu.com/share/link?shareid=830873155&uk=3573928349
tar -zxvf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure
make
make install
protoc –version
4.安裝ANT
wget http://mirror.bit.edu.cn/apache/ant/binaries/apache-ant-1.9.4-bin.tar.gz
tar -zxvf apache-ant-1.9.4-bin.tar.gz -C /usr/local
vi /etc/profile
export ANT_HOME=/usr/local/apache-ant-1.9.4
export PATH=$PATH:$ANT_HOME/bin
5.安裝maven
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.1/binaries/apache-maven-3.3.1-bin.tar.gz
tar -zxvf apache-maven-3.3.1-bin.tar.gz -C /usr/local
vi /etc/profile
export MAVEN_HOME=/usr/local/apache-maven-3.3.1
export PATH=$PATH:$MAVEN_HOME/bin
修改配置檔案
vi /usr/local/apache-maven-3.3.1/conf/settings.xml
更改maven資料庫,在<mirrors></mirros>裡新增如下內容:
<mirror>
<id>nexus-osc</id>
<mirrorOf>*</mirrorOf>
<name>Nexusosc</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
在<profiles></profiles>內新新增
<profile>
<id>jdk-1.7</id>
<activation>
<jdk>1.7</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
在shell下執行,使環境變數生效
source /etc/profile
7.編譯 Hadoop2.6.0
wget http://mirror.bit.edu.cn/apache/hadoop/core/hadoop-2.6.0/hadoop-2.6.0-src.tar.gz
cd hadoop-2.6.0-src
mvn package -DskipTests -Pdist,native -Dtar
如果是第一次使用maven,會列印很多如下日誌資訊
Downloading: http://maven.oschina.net/…
Scanning for projects…
…
[INFO] Apache Hadoop Main …………………………… SUCCESS [ 4.590 s]
[INFO] Apache Hadoop Project POM …………………….. SUCCESS [ 3.503 s]
[INFO] Apache Hadoop Annotations …………………….. SUCCESS [ 5.870 s]
[INFO] Apache Hadoop Assemblies ……………………… SUCCESS [ 0.540 s]
[INFO] Apache Hadoop Project Dist POM ………………… SUCCESS [ 3.921 s]
[INFO] Apache Hadoop Maven Plugins …………………… SUCCESS [ 7.731 s]
[INFO] Apache Hadoop MiniKDC ………………………… SUCCESS [ 6.805 s]
[INFO] Apache Hadoop Auth …………………………… SUCCESS [ 9.008 s]
[INFO] Apache Hadoop Auth Examples …………………… SUCCESS [ 6.991 s]
[INFO] Apache Hadoop Common …………………………. SUCCESS [03:12 min]
[INFO] Apache Hadoop NFS ……………………………. SUCCESS [ 16.557 s]
[INFO] Apache Hadoop KMS ……………………………. SUCCESS [ 24.476 s]
[INFO] Apache Hadoop Common Project ………………….. SUCCESS [ 0.115 s]
[INFO] Apache Hadoop HDFS …………………………… SUCCESS [05:09 min]
[INFO] Apache Hadoop HttpFS …………………………. SUCCESS [ 40.145 s]
[INFO] Apache Hadoop HDFS BookKeeper Journal ………….. SUCCESS [ 15.876 s]
[INFO] Apache Hadoop HDFS-NFS ……………………….. SUCCESS [ 9.236 s]
[INFO] Apache Hadoop HDFS Project ……………………. SUCCESS [ 0.125 s]
[INFO] hadoop-yarn …………………………………. SUCCESS [ 0.129 s]
[INFO] hadoop-yarn-api ……………………………… SUCCESS [02:49 min]
[INFO] hadoop-yarn-common …………………………… SUCCESS [01:01 min]
[INFO] hadoop-yarn-server …………………………… SUCCESS [ 0.099 s]
[INFO] hadoop-yarn-server-common …………………….. SUCCESS [ 25.019 s]
[INFO] hadoop-yarn-server-nodemanager ………………… SUCCESS [ 33.655 s]
[INFO] hadoop-yarn-server-web-proxy ………………….. SUCCESS [ 5.761 s]
[INFO] hadoop-yarn-server-applicationhistoryservice ……. SUCCESS [ 13.714 s]
[INFO] hadoop-yarn-server-resourcemanager …………….. SUCCESS [ 41.930 s]
[INFO] hadoop-yarn-server-tests ……………………… SUCCESS [ 13.364 s]
[INFO] hadoop-yarn-client …………………………… SUCCESS [ 17.408 s]
[INFO] hadoop-yarn-applications ……………………… SUCCESS [ 0.042 s]
[INFO] hadoop-yarn-applications-distributedshell ………. SUCCESS [ 5.131 s]
[INFO] hadoop-yarn-applications-unmanaged-am-launcher ….. SUCCESS [ 3.710 s]
[INFO] hadoop-yarn-site …………………………….. SUCCESS [ 0.107 s]
[INFO] hadoop-yarn-registry …………………………. SUCCESS [ 12.531 s]
[INFO] hadoop-yarn-project ………………………….. SUCCESS [ 7.781 s]
[INFO] hadoop-mapreduce-client ………………………. SUCCESS [ 0.116 s]
[INFO] hadoop-mapreduce-client-core ………………….. SUCCESS [ 47.915 s]
[INFO] hadoop-mapreduce-client-common ………………… SUCCESS [ 38.104 s]
[INFO] hadoop-mapreduce-client-shuffle ……………….. SUCCESS [ 9.073 s]
[INFO] hadoop-mapreduce-client-app …………………… SUCCESS [01:01 min]
[INFO] hadoop-mapreduce-client-hs ……………………. SUCCESS [ 18.149 s]
[INFO] hadoop-mapreduce-client-jobclient ……………… SUCCESS [ 9.002 s]
[INFO] hadoop-mapreduce-client-hs-plugins …………….. SUCCESS [ 3.222 s]
[INFO] Apache Hadoop MapReduce Examples ………………. SUCCESS [ 13.224 s]
[INFO] hadoop-mapreduce …………………………….. SUCCESS [ 6.571 s]
[INFO] Apache Hadoop MapReduce Streaming ……………… SUCCESS [ 9.781 s]
[INFO] Apache Hadoop Distributed Copy ………………… SUCCESS [ 16.254 s]
[INFO] Apache Hadoop Archives ……………………….. SUCCESS [ 5.302 s]
[INFO] Apache Hadoop Rumen ………………………….. SUCCESS [ 13.760 s]
[INFO] Apache Hadoop Gridmix ………………………… SUCCESS [ 8.858 s]
[INFO] Apache Hadoop Data Join ………………………. SUCCESS [ 6.252 s]
[INFO] Apache Hadoop Ant Tasks ………………………. SUCCESS [ 4.276 s]
[INFO] Apache Hadoop Extras …………………………. SUCCESS [ 6.206 s]
[INFO] Apache Hadoop Pipes ………………………….. SUCCESS [ 1.945 s]
[INFO] Apache Hadoop OpenStack support ……………….. SUCCESS [ 12.239 s]
[INFO] Apache Hadoop Amazon Web Services support ………. SUCCESS [ 38.137 s]
[INFO] Apache Hadoop Client …………………………. SUCCESS [ 13.213 s]
[INFO] Apache Hadoop Mini-Cluster ……………………. SUCCESS [ 0.169 s]
[INFO] Apache Hadoop Scheduler Load Simulator …………. SUCCESS [ 13.206 s]
[INFO] Apache Hadoop Tools Dist ……………………… SUCCESS [ 15.248 s]
[INFO] Apache Hadoop Tools ………………………….. SUCCESS [ 0.162 s]
[INFO] Apache Hadoop Distribution ……………………. SUCCESS [01:09 min]
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 25:19 min
[INFO] Finished at: 2015-03-26T17:54:10+08:00
[INFO] Final Memory: 106M/402M
[INFO] ————————————————————————
經過漫長的等待編譯過程後,編譯成功後會打包,放在hadoop-dist/target
#ll
total 528824
drwxr-xr-x 2 root root 4096 Mar 26 17:53 antrun
-rw-r–r– 1 root root 1874 Mar 26 17:53 dist-layout-stitching.sh
-rw-r–r– 1 root root 647 Mar 26 17:53 dist-tar-stitching.sh
drwxr-xr-x 9 root root 4096 Mar 26 17:53 hadoop-2.6.0
-rw-r–r– 1 root root 180222548 Mar 26 17:53 hadoop-2.6.0.tar.gz
-rw-r–r– 1 root root 2777 Mar 26 17:53 hadoop-dist-2.6.0.jar
-rw-r–r– 1 root root 361254421 Mar 26 17:54 hadoop-dist-2.6.0-javadoc.jar
drwxr-xr-x 2 root root 4096 Mar 26 17:53 javadoc-bundle-options
drwxr-xr-x 2 root root 4096 Mar 26 17:53 maven-archiver
drwxr-xr-x 2 root root 4096 Mar 26 17:53 test-dir
編譯後的檔案見百度雲盤
然後把lib下native下的檔案覆蓋掉hadoop下native中檔案就ok了
相關文章
- Centos64位6.3 下安裝 Mysql5.6CentOSMySql
- windows下使用Eclipse編譯執行MapReduce程式 Hadoop2.6.0/UbuntuWindowsEclipse編譯HadoopUbuntu
- linux(ubuntu)下的64位編譯器編譯32位程式LinuxUbuntu編譯
- 如何在64位Linux系統上用gcc編譯32位程式LinuxGC編譯
- 程式碼線上編譯器(上)- 編輯及編譯編譯
- mac上編譯FFmpegMac編譯
- 反編譯系列教程(上)編譯
- 【FFmpeg】Windows下64位ffmpeg編譯Windows編譯
- 在CentOS 7上編譯QtumCentOS編譯QT
- windows上使用clang編譯程式Windows編譯
- 如何在Windows上編譯Docker?Windows編譯Docker
- hadoop64位系統編譯Hadoop編譯
- win7 64位編譯WebKit核心Win7編譯WebKit
- ubuntu x86-64位機器下編譯32位彙編的問題Ubuntu編譯
- 32位支援:使用 GCC 交叉編譯GC編譯
- PyTorch在64位Windows下的編譯PyTorchWindows編譯
- 【Redis】原始碼編譯二進位制包Redis原始碼編譯
- 深入剖析Java即時編譯器(上)Java編譯
- Hadoop - macOS 上編譯 Hadoop 3.2.1HadoopMac編譯
- vue專案編譯node記憶體溢位Vue編譯記憶體溢位
- win10 64位系統下openssl編譯Win10編譯
- 在Ubuntu X64上編譯HadoopUbuntu編譯Hadoop
- Ubuntu上編譯多個版本的fridaUbuntu編譯
- 關於64位Linux編譯hadoop2Linux編譯Hadoop
- 二進位制發行包還是編譯安裝編譯
- 編譯並裁剪 FFmpeg 在 Android 上做視訊編輯編譯Android
- <摘錄>如何在64位linux強制編譯32位應用程式Linux編譯
- Java編譯與反編譯Java編譯
- vs2013編譯boost1.55.0 32/64位編譯
- GO 1.5 程式碼編譯安裝 [centos7 64位]Go編譯CentOS
- Ubuntu上的pycrypto給出了編譯器錯誤Ubuntu編譯
- 0909 編譯原理 第1次上機編譯原理
- windows10下編譯32位和64位webrtc(m77)靜態庫Windows編譯Web
- Linux 上最好的十六進位制編輯器Linux
- 編譯編譯
- OS 7: 如何為iPhone 5S編譯64位應用。iPhone編譯
- hadoop編譯—+2.x編譯Hadoop編譯
- gcc 編譯器與 clang 編譯器GC編譯