一、下载
[root@localhost secrets]# cd /usr/local/src/
[root@localhost src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
二、解压
[root@localhost src]# tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /usr/local/
三、添加环境变量
[root@localhost apache-maven-3.6.3]# echo "export MAVEN_HOME=/usr/local/apache-maven-3.6.3">>/etc/profile
[root@localhost apache-maven-3.6.3]# echo "export PATH=$PATH:/usr/local/apache-maven-3.6.3/bin">>/etc/profile
[root@localhost apache-maven-3.6.3]# source /etc/profile
四、验证
[root@localhost apache-maven-3.6.3]# mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/apache-maven-3.6.3
Java version: 1.8.0_292, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
[root@localhost apache-maven-3.6.3]#