一、编译环境准备
1、安装依赖软件
yum -y install wget git gcc gcc-c++ make autoconf automake libtool sharutils asciidoc xmlto cmake unzip zip
2、安装Java环境
下载地址:https://www.oracle.com/java/technologies/downloads/ 解压安装
mkdir /usr/java
tar -zxvf jdk-8u321-linux-x64.tar.gz -C /usr/java
3、安装maven环境
下载地址:https://maven.apache.org/download.cgi 解压安装
mkdir /usr/local/maven
tar -zxvf apache-maven-3.8.4-bin.tar.gz -C /usr/local/maven
settings.xml配置
</proxies>
<proxy>
<id>MavenProxy</id>
<active>true</active>
<protocol>http</protocol>
<username>admin</username>
<password>admin</password>
<host>proxy_ip</host>
<port>proxy_port</port>
<nonProxyHosts>maven.aliyun.com|mirrors.huaweicloud.com</nonProxyHosts>
</proxy>
</proxies>
</mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>huaweicloud</id>
<mirrorOf>central</mirrorOf>
<name>huawei cloud</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
</mirrors>
4、配置环境变量
编辑/etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_321
export PATH=$PATH:$JAVA_HOME/bin
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.4
export PATH=$MAVEN_HOME/bin:$PATH
使环境变量生效
source /etc/profile
二、编译Ranger
1、下载ranger
git clone https://github.com/apache/ranger.git
cd ranger
git checkout ranger-2.2
2、开始编译
mvn clean compile package install -DskipTests -Drat.skip=true
3、编译完成
4、编译成果
cd /root/ranger/target
ranger-2.2.0编译后压缩包下载地址:https://download.csdn.net/download/qq_24817093/85311287
三、编译过程中遇到的问题
1、问题1
解决方案: 编辑apache-ranger-2.2.0/ranger-util/pom.xml文件,将python3改为python2
2、问题2
解决方案: 编辑ranger-examples/distro/src/main/assembly/plugin-sampleapp.xml和ranger-examples/distro/src/main/assembly/sampleapp.xml 在moduleSets下添加如下内容
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
|