[root@VM_0_3_centos mvn]# wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
--2018-09-11 23:07:08-- http://mirrors.hust.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
Resolving mirrors.hust.edu.cn (mirrors.hust.edu.cn)... 202.114.18.160
Connecting to mirrors.hust.edu.cn (mirrors.hust.edu.cn)|202.114.18.160|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5494427 (5.2M) [application/octet-stream]
Saving to: ‘apache-maven-3.1.1-bin.tar.gz’
100%[=================================================================================================================================>] 5,494,427 833KB/s in 8.9s
2018-09-11 23:07:18 (603 KB/s) - ‘apache-maven-3.1.1-bin.tar.gz’ saved [5494427/5494427]
[root@VM_0_3_centos mvn]# tar zxf apache-maven-3.1.1-bin.tar.gz
[root@VM_0_3_centos mvn]# ls
apache-maven-3.1.1 apache-maven-3.1.1-bin.tar.gz
[root@VM_0_3_centos mvn]# mv apache-maven-3.1.1 /usr/local/maven3
[root@VM_0_3_centos mvn]# vi /etc/profile
添加
export M2_HOME=/usr/local/maven3
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
[root@VM_0_3_centos mvn]# source /etc/profile
[root@VM_0_3_centos mvn]# ls
apache-maven-3.1.1-bin.tar.gz
[root@VM_0_3_centos mvn]# mvn -v
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 23:22:22+0800)
Maven home: /usr/local/maven3
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/local/jdk/jdk1.8.0_131/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "amd64", family: "unix"