hadoop64位系統編譯
hadoop原始碼編譯64位系統版本
寫在前面:
因為Hadoop不提供64位編譯好的版本,只能用原始碼自行編譯64位版本,所以本文以hadoop2.6.0為例進行原始碼編譯。值得注意的是如果想編譯2.6.0版本的hadoop需要用JDK7,如果用JDK8編譯會報這樣的錯誤:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-annotations: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /home/hadoop/hadoop-2.5.2-src/hadoop-common-project/hadoop-annotations/src/main/java/org/apache/hadoop/classification/InterfaceStability.java:27: 錯誤: 意外的結束標記: </ul>
[ERROR] * </ul>
[ERROR] ^
[ERROR]
[ERROR] Command line was: /usr/java/jre/../bin/javadoc @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '/home/hadoop/hadoop-2.5.2-src/hadoop-common-project/hadoop-annotations/target' dir.
[ERROR] -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-annotations
這是JDK版本引起的,而高版本的hadoop(如2.7.2是可以用JDK8成功編譯的)。不過編譯完成後的hadoop可以用JDK8執行。總的來說就是想編譯高版本的hadoop就用適當高版本的JDK。 還有一點是官網下載的tar.gz直接能用的安裝包是不能直接編譯的,需要對-src.tar.gz進行編譯。
具體步驟:
- 安裝JDK,配置環境變數
- 安裝maven,先解壓,再配置環境變數。網不好的話最好用阿里雲映象
cd /opt/install/apache-maven-3.0.5
vi conf/settings.xml
找到mirros標籤加入:
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
最後不要忘記配置maven環境變數
vi /etc/profile
#MAVEN_HOME
export MAVEN_HOME=/opt/install/apache-maven-3.0.5
export PATH=$PATH:$MAVEN_HOME/bin
:wq
source /etc/profile
檢查:
mvn -version
- 配置ant:先解壓,再配置環境變數,和JDK配置一樣
vi /etc/profile
#MAVEN_HOME
export MAVEN_HOME=/opt/install/apache-ant-1.9.9
export PATH=$PATH:$MAVEN_HOME/bin
:wq
source /etc/profile
ant -version
- 安裝glibc-headers、g++、make和cmake,openssl庫與ncurses-devel庫。yum安裝即可
yum -y install glibc-headers
yum -y install gcc-c++
yum -y install make
yum -y install cmake
yum -y install openssl-devel
yum -y install ncurses-devel
- 安裝protobuf,先解壓,再進入目錄:
cd /opt/install/protobuf-2.5.0/
./configure
make
make check
make install
ldconfig
編輯配置檔案
vi /etc/profile
#LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/install/protobuf-2.5.0
export PATH=$PATH:$LD_LIBRARY_PATH
:wq
source /etc/profile
protoc --version
- 編譯原始碼
tar -zxvf hadoop-2.6.0-src.tar.gz
進入cd /opt/install/hadoop-2.7.2-src/
這裡需要修改一下我們JDK對應的版本:
vi pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<rules>
<requireMavenVersion>
<version>[3.0.2,)</version>
</requireMavenVersion>
<requireJavaVersion>
<!- 在這裡修改對應版本 ->
<version>1.7</version>
</requireJavaVersion>
</rules>
</configuration>
</plugin>
mvn package -Pdist,native -DskipTests -Dtar
接下來就會開始原始碼編譯,但這個過程會很漫長。我自己是編譯了差不多四個小時,這都取決於網速和配置等因素。
最後,編譯成功後我們要的安裝包在:/opt/install/hadoop-2.7.2-src/hadoop-dist/target/下
相關文章
- win10 64位系統下openssl編譯Win10編譯
- 如何在64位Linux系統上用gcc編譯32位程式LinuxGC編譯
- 編譯系統概要編譯
- Linux系統下編譯Openssl 步驟:Linux編譯
- ubuntu系統編譯安裝OpenCV 4.4Ubuntu編譯OpenCV
- AT&T彙編之32位與64位系統呼叫
- 編譯安裝最新的Linux系統核心編譯Linux
- Ubuntu 18.04系統編譯安裝Memcached教程。Ubuntu編譯
- Ubuntu 18.04系統編譯安裝Redis教程。Ubuntu編譯Redis
- Ubuntu 18.04系統編譯安裝Apache教程。Ubuntu編譯Apache
- Ubuntu 18.04系統編譯安裝PHP教程。Ubuntu編譯PHP
- Ubuntu 18.04系統編譯安裝Tomcat教程。Ubuntu編譯Tomcat
- Ubuntu 18.04系統編譯安裝Docker教程。Ubuntu編譯Docker
- Ubuntu 20.04系統編譯安裝Apache教程。Ubuntu編譯Apache
- Ubuntu 20.04系統編譯安裝PHP教程。Ubuntu編譯PHP
- Ubuntu 20.04系統編譯安裝phpMyAdmin教程。Ubuntu編譯PHP
- Ubuntu 20.04系統編譯安裝Tomcat教程。Ubuntu編譯Tomcat
- Ubuntu 20.04系統編譯安裝Docker教程。Ubuntu編譯Docker
- Ubuntu 20.04系統編譯安裝Redis教程。Ubuntu編譯Redis
- Ubuntu 20.04系統編譯安裝Memcached教程。Ubuntu編譯
- Centos7系統編譯Hadoop3.3.4CentOS編譯Hadoop
- OS-鴻蒙系統-以及編譯器鴻蒙編譯
- 重走LFS之路:(九) 基礎系統編譯-2編譯
- 重走LFS之路:(八) 基礎系統編譯-1編譯
- Ubuntu 18.04系統編譯安裝Nginx 1.22教程。Ubuntu編譯Nginx
- Ubuntu 18.04系統編譯安裝MySQL 5.7教程。Ubuntu編譯MySql
- Debian11系統編譯安裝Nginx教程。編譯Nginx
- Debian11系統編譯安裝PHP教程。編譯PHP
- Debian11系統編譯安裝phpMyAdmin教程。編譯PHP
- Debian11系統編譯安裝Apache教程。編譯Apache
- Debian11系統編譯安裝Tomcat教程。編譯Tomcat
- Debian11系統編譯安裝Docker教程。編譯Docker
- Debian11系統編譯安裝Memcached教程。編譯
- Debian11系統編譯安裝Redis教程。編譯Redis
- ubuntu x86-64位機器下編譯32位彙編的問題Ubuntu編譯
- Windows系統編譯libhv帶SSL,開啟WITH_OPENSSLWindows編譯
- Centos8 stream系統編譯安裝Memcached教程。CentOS編譯
- Centos8 stream系統編譯安裝Redis教程。CentOS編譯Redis