注:需先安装JDK,openjdk是阉割版不可用,需卸载重新安装jdk1.8
rpm -qa |grep openjdk |xargs rpm -e --nodeps
1.下载
官网地址:Maven – Download Apache Maven
2. 解压
mkdir /usr/local/maven
tar -zxvf apache-maven-3.8.2-bin.tar.gz -C /usr/local/maven
3.修改配置文件设置maven仓库
vim /usr/local/maven/apache-maven-3.8.2
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
4.添加全局变量
vim /etc/profile
export M2_HOME=/usr/local/maven/apache-maven-3.8.2
export PATH=${PATH}:${M2_HOME}/bin:${JAVA_HOME}/bin
source /etc/profile
5.验证
mvn -v