1.切换到/usr/local目录下,执行wget http://apache.fayea.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz来下载maven
2.解压:tar -zxvf apache-maven-3.3.9-bin.tar.gz
3.修改settings.xml在mirrors中添加以下内容修改为国内镜像
<mirror>
<id>nexus-osc</id>
<mirrorOf>*<mirrorOf/>
<name>Nexus osc<name/>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
4.修改etc/profile 环境变量,在最后添加以下两行
export MAVEN_HOME=/usr/local/apache-maven-3.3.9
export PATH=${PATH}:${MAVEN_HOME}/bin
5.source /etc/profile// 使上面配置生效
6.mvn -v验证是否安装成功