1、首先需要下载maven安装包(我下载的是apache-maven-3.5.3版本)
官网下载:http://maven.apache.org/download.cgi
2、将压缩包放到虚拟机下(我的存放目录/opt/bigdata)
解压缩:
tar -zxvf apache-maven-3.5.3-bin.tar.gz
3、配置maven环境变量
vi /etc/profile //添加环境变量(下面的加在最后) export MAVEN_HOME=/var/local/apache-maven-3.5.2 export MAVEN_HOME export PATH=$PATH:$MAVEN_HOME/bin
//执行以下命令使环境变量生效
source /etc/profile
4、验证结果
[root@wangmaster bigdata]# mvn -version Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00) Maven home: /opt/bigdata/apache-maven-3.5.3 Java version: 1.8.0_111, vendor: Oracle Corporation Java home: /opt/bigdata/jdk1.8/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-327.el7.x86_64", arch: "amd64", family: "unix"