1.下载压缩包
http://maven.apache.org/download.cgi
2.上传到服务器并解压
tar -xzvf apache-maven-3.6.3-bin.tar.gz
3.修改配置文件
#解压目录里 conf/settings.xml
<localRepository>/usr/local/maven/repository</localRepository>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
4.设置环境变量
#/etc/profile
MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=${MAVEN_HOME}/bin:${PATH}
#加载环境变量
source /etc/profile