1.下载maven
链接: https://pan.baidu.com/s/1gTmIWBFBdIQob0cqGG3E_Q 提取码: 42ck,apache-maven-3.8.4-bin.zip
2.安装java jdk
yum install -y java-1.8.0-openjdk-devel
3.在/opt目录下新建目录
mkdir /opt/maven
4.将apache-maven-3.8.4-bin.zip上传到/opt/maven目录后并解压文件
unzip apache-maven-3.8.4-bin.zip
5.配置阿里云国内镜像,进入解压后的目录
cd apache-maven-3.8.4/conf
6.编辑settings.xml文件
vim settings.xml
在<mirrors>标签内添加内容,并将原有的内容删掉<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/\</url>
<mirrorOf>central</mirrorOf>
</mirror>
7.修改环境变量
vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export MAVEN_HOME=/opt/maven/apache-maven-3.8.4
export PATH=PATH:JAVA_HOME/bin:$MAVEN_HOME/bin
8.使配置生效
source /etc/profile
9.查看maven版本
mvn -v