您好,登錄后才能下訂單哦!
本篇內容介紹了“怎么編譯Hadoop2.7.6”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
環境:虛擬機
#!/usr/bin/env bash set -e # 軟件準備 # JDK下載地址 https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html # 域名 admin.xdata.dongjihui.com 當前解析內網地址,公網無法訪問,請自行下載jdk。 wget -cP /data/software/oracle/jdk/ http://admin.xdata.dongjihui.com/data/software/oracle/jdk/jdk-8u202-linux-x64.tar.gz wget -cP /data/software/apache/hadoop/ https://archive.apache.org/dist/hadoop/common/hadoop-2.7.6/hadoop-2.7.6.tar.gz wget -cP /data/software/apache/hadoop/ https://archive.apache.org/dist/hadoop/common/hadoop-2.7.6/hadoop-2.7.6-src.tar.gz wget -cP /data/software/apache/maven/ https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz wget -cP /data/software/apache/ant/ https://mirrors.tuna.tsinghua.edu.cn/apache/ant/binaries/apache-ant-1.9.15-bin.tar.gz wget -cP /data/software/google/protobuf/ https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz wget -cP /data/software/google/snappy/ https://github.com/google/snappy/archive/1.1.7.tar.gz # 依賴庫 sudo apt-get install -y gcc g++ subversion libapache2-mod-svn git wget curl build-essential autoconf automake libtool cmake zlib1g-dev libbz2-dev pkg-config libssl1.0-dev # 創建目錄 mkdir -p /data/app/java/ /data/app/apache/hadoop /data/app/apache/ant /data/app/apache/maven /data/src # 安裝protobuf cd /data/src tar zxf /data/software/google/protobuf/protobuf-2.5.0.tar.gz cd protobuf-2.5.0/ ./configure make make check sudo make install sudo ldconfig # 安裝snappy cd /data/src/ tar zxf /data/software/google/snappy/1.1.7.tar.gz cd snappy-1.1.7/ mkdir build && cd build && cmake ../ && make sudo make install # 安裝jdk cd /data/app/java/ tar zxf /data/software/oracle/jdk/jdk-8u202-linux-x64.tar.gz ln -s jdk1.8.0_202 cur_jdk # 安裝ant cd /data/app/apache/ant/ tar zxf /data/software/apache/ant/apache-ant-1.9.15-bin.tar.gz ln -s apache-ant-1.9.15 cur_ant # 安裝并配置maven cd /data/app/apache/maven tar zxf /data/software/apache/maven/apache-maven-3.5.4-bin.tar.gz ln -s apache-maven-3.5.4 cur_maven sed \ -e 54a'\ <localRepository\>/data/app/apache/maven/repo\</localRepository\>' \ -e 158a'\ \<mirror\>' \ -e 158a'\ \<id\>aliyunmaven\</id\>' \ -e 158a'\ \<mirrorOf\>*\</mirrorOf\>' \ -e 158a'\ \<name\>阿里云公共倉庫\</name\>' \ -e 158a'\ \<url\>https://maven.aliyun.com/repository/public\</url\>' \ -e 158a'\ \</mirror\>' \ -i cur_maven/conf/settings.xml # 解壓hadoop,用于驗證本地庫 cd /data/app/apache/hadoop tar zxf /data/software/apache/hadoop/hadoop-2.7.6.tar.gz ln -s hadoop-2.7.6 cur_hadoop # 配置環境變量 cat>env4app.sh<<-'EOF' export JAVA_HOME=/data/app/java/cur_jdk export CLASSPATH=.:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib:${CLASSPATH} export M2_HOME=/data/app/apache/maven/cur_maven export ANT_HOME=/data/app/apache/ant/cur_ant export HADOOP_PREFIX=/data/app/apache/hadoop/cur_hadoop export TMPPATH=.:${JAVA_HOME}/bin:${M2_HOME}/bin:${ANT_HOME}/bin:${HADOOP_PREFIX}/bin export PATH=${TMPPATH}:$PATH EOF if [ -f /etc/profile.d/env4app.sh ]; then sudo mv /etc/profile.d/env4app.sh{,.bak-`date +%Y%m%d%H%M%S`}; fi sudo mv env4app.sh /etc/profile.d/; source /etc/profile source ~/.profile # 編譯 cd /data/src/ tar zxf /data/software/apache/hadoop/hadoop-2.7.6-src.tar.gz cd hadoop-2.7.6-src/ mvn clean package -Pdist,native -DskipTests -Dtar # 部署 cd ${HADOOP_PREFIX}/lib/ mv native{,.bak} cp -r /data/src/hadoop-2.7.6-src/hadoop-dist/target/hadoop-2.7.6/lib/native . cd ${HADOOP_PREFIX}/ # 檢查 bin/hadoop checknative -a echo "執行完畢@`date +%c`"
“怎么編譯Hadoop2.7.6”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。