1.在apache官网找到下载地址
2.使用wget命令和复制的链接地址下载tar.gz包
$ wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
3.解压下载的tar.gz包
$ tar -zxvf apache-maven-3.5.0-bin.tar.gz
3.配置环境变量
编辑profile文件
$ sudo vim /etc/profile
在文件末尾加入
export MAVEN_HOME=/home/sj/environment/apache-maven-3.5.0/
export PATH=${PATH}:${MAVEN_HOME}/bin
使资源文件生效
$ source /etc/profile
4.查看maven版本
$ mvn -v
出现以下内容表示maven环境配置成功
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /home/sj/environment/apache-maven-3.5.0
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/java/jre1.8.0_144
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.26.2.el7.x86_64", arch: "amd64", family: "unix"