- 虚拟机安装wget命令
yum -y install wget
- 下载maven包
wget https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz --no-check-certificate
- 移动maven安装包
[root@localhost home]# cd /.
[root@localhost /]# cp apache-maven-3.6.1-bin.tar.gz /usr/local/home/maven/
- 解压
[root@localhost /]# cd usr/local/home/maven/
[root@localhost maven]# ll
总用量 8924
-rw-r--r--. 1 root root 9136463 11月 27 17:01 apache-maven-3.6.1-bin.tar.gz
[root@localhost maven]# tar -zxvf apache-maven-3.6.1-bin.tar.gz
- 配置环境变量
[root@localhost apache-maven-3.6.1]# vi /etc/profile
MAVEN_HOME=/usr/local/home/maven/apache-maven-3.6.1
PATH=$MAVEN_HOME/bin:$PATH
export MAVEN_HOME PAT
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/906673885c40224f46a41c69a47321ad.png)
生效
[root@localhost apache-maven-3.6.1]# source /etc/profile
查看版本
mvn -version
[root@localhost apache-maven-3.6.1]# mvn -version
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a8c9be1d72bab77328a6b60495fcad47.png)
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: /usr/local/home/maven/apache-maven-3.6.1
Java version: 1.8.0_352, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.352.b08-2.el7_9.x86_64/jre
Default locale: zh_CN, platform encoding: UTF-8