1.Centos下载安装
# 下载
wget https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
# 解压
tar -zxvf apache-maven-3.3.9-bin.tar.gz -C /opt
# 添加环境变量
vi /etc/profile
# 文件末尾添加
export MAVEN_HOME=/opt/apache-maven-3.3.9
export PATH=$PATH:$MAVEN_HOME/bin
# 使环境变量生效
source /etc/profile
# 查看版本号
mvn -v
2.IDEA自动下载安装

3.配置阿里云镜像源(重启电脑生效)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>H:\repository</localRepository>
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven-central</id>
<mirrorOf>central</mirrorOf>
<name>aliyun-central</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
<mirror>
<id>alimaven-public</id>
<name>aliyun-public</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>gradle-plugin</id>
<name>gradle-plugin</name>
<url>https://maven.aliyun.com/repository/gradle-plugin</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>apache-snapshots</id>
<name>apache-snapshots</name>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<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>
</settings>