编译环境
Vultr 美国新泽西皮斯 4CPU 4GB vps
Centos 7.7
jdk-8u241-linux-x64.tar.gz
maven3.6.3
protocbuf 2.5.0
findbugs-3.0.1
编译前准备
安装C和C++编译器
yum -y install gcc gcc-c++
安装Cmake 3.13.5
wget https://cmake.org/files/v3.13/cmake-3.13.5.tar.gz tar -zxvf cmake-3.13.5.tar.gz cd cmake-3.13.5 ./bootstrap --prefix=/usr/local gmake make install /usr/local/bin/cmake --version cd .. yum remove cmake -y ln -s /usr/local/bin/cmake /usr/bin/ cmake --version
安装其他软件包
yum -y install autoconf automake libtool curl yum -y install lzo-devel zlib-devel openssl openssl-devel ncurses-devel yum -y install snappy snappy-devel bzip2 bzip2-devel lzo lzo-devel lzop libXtst
安装Java 8环境
下载Java 8SE
jdk-8u241-linux-x64.tar.gz
tar xvfz jdk-8u241-linux-x64.tar.gz -C /usr ln -s /usr/jdk1.8.0_241 /usr/jdkcat >> /etc/profile<<EOF JAVA_HOME=/usr/jdk export JAVA_HOME CLASSPATH=.:\$JAVA_HOME/lib:\$CLASSPATH export CLASSPATH PATH=\$JAVA_HOME/bin:\$PATH export PATH EOF source /etc/profile java -version
安装maven
下载apache-maven-3.6.3-bin.tar.gz
tar xvf apache-maven-3.6.3-bin.tar.gz -C /usrmv /usr/apache-maven-3.6.3 /usr/mavencat >> /etc/profile<<EOF MAVEN_HOME=/usr/maven export MAVEN_HOME PATH=/usr/maven/bin:\$PATH export PATH EOF source /etc/profile mvn -version
安装protobuf 2.5.0
下载protobuf-2.5.0.tar.gz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 tar xvfz protobuf-2.5.0.tar.gz -C /usr/localcd /usr/ local /protobuf-2.5.0 ./autogen.sh ./configure --prefix=/usr/local/protobuf make make check make install ldconfig vi /etc/profileexport LIBRARY_PATH=$LIBRARY_PATH :/usr/local/protobuf/libexport PATH=$PATH :/usr/local/protobuf/binsource /etc/profile protoc --version
安装findbugs
下载findbugs-3.0.1.tar.gz
tar xvfz findbugs-3.0.1.tar.gz -C /usrcat >> /etc/profile<<EOF export FINDBUGS_HOME=/usr/findbugs-3.0.1 export PATH=\$PATH:\$FINDBUGS_HOME/bin EOF source /etc/profile findbugs -version
安装ant
下载apache-ant-1.10.7-bin.tar.gz
tar xvfz apache-ant-1.10.7-bin.tar.gz -C /usrcat >> /etc/profile<<EOF export ANT_HOME=/usr/apache-ant-1.10.7 export PATH=\$ANT_HOME/bin:\$PATH EOF source /etc/profile ant -version
编译Hadoop3.1.3
下载hadoop-3.1.3-src.tar.gz源码
tar xvfz hadoop-3.1.3-src.tar.gz -C /usrcd /usr/hadoop-3.1.3-srcexport MAVEN_OPTS="-Xms256m -Xmx512m" mvn package -Pdist,native -DskipTests -Dtar
编译成功:
编译成功后释放至/opt
编译完成后的Hadoop在hadoop-dist/target/hadoop-3.1.3.tar.gz
解压释放:
解压释放: tar xvfz hadoop-3.1.3.tar.gz -C /opt 然后确定文件夹名为hadoopmv hadoop-3.1.3 hadoop