前言
主要是记录下新的体会
准备系统
最好是新装的系统,当前使用的是ubuntu20.lts
工具安装
看源码中的build.txt文件中建议使用的ubuntu14.04版本,本地使用的20版本一样的。工具准备参考如下章节猛装就行。
需要注意的是安装的时候用户的使用,保持一致性,否则会给后面编译造成问题。
Installing required packages for clean install of Ubuntu 14.04 LTS Desktop: * Oracle JDK 1.8 (preferred) $ sudo apt-get purge openjdk* $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer * Maven $ sudo apt-get -y install maven * Native libraries $ sudo apt-get -y install build-essential autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev libsasl2-dev * Protocol Buffers 3.7.1 (required to build native code) $ curl -L -s -S https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-java-3.7.1.tar.gz -o protobuf-3.7.1.tar.gz $ mkdir protobuf-3.7-src $ tar xzf protobuf-3.7.1.tar.gz --strip-components 1 -C protobuf-3.7-src && cd protobuf-3.7-src $ ./configure $ make -j$(nproc) $ sudo make install Optional packages: * Snappy compression (only used for hadoop-mapreduce-client-nativetask) $ sudo apt-get install snappy libsnappy-dev * Intel ISA-L library for erasure coding Please refer to https://01.org/intel%C2%AE-storage-acceleration-library-open-source-version (OR https://github.com/01org/isa-l) * Bzip2 $ sudo apt-get install bzip2 libbz2-dev * Linux FUSE $ sudo apt-get install fuse libfuse-dev
编译
安装build.txt文件中描述编译就行
Building distributions: Create binary distribution without native code and without documentation: $ mvn package -Pdist -DskipTests -Dtar -Dmaven.javadoc.skip=true Create binary distribution with native code and with documentation: $ mvn package -Pdist,native,docs -DskipTests -Dtar Create source distribution: $ mvn package -Psrc -DskipTests Create source and binary distributions with native code and documentation: $ mvn package -Pdist,native,docs,src -DskipTests -Dtar Create a local staging version of the website (in /tmp/hadoop-site) $ mvn clean site -Preleasedocs; mvn site:stage -DstagingDirectory=/tmp/hadoop-site Note that the site needs to be built in a second pass after other artifacts.
总结