Please make sure you have installed JDK before installation.
1 Copy the maven installation file to the server. Download to attachment
2 Create the maven installation directory
[root@iZ94zsv4mnfZ ~]# mkdir /usr/local/maven
3 Unzip the installation file to the installation directory
[root@iZ94zsv4mnfZ ~]# tar -zxvf apache-maven-3.3.3-bin.tar.gz -C /usr/local/maven/
4 Increase environment variables
[root@iZ94zsv4mnfZ ~]# vim /etc/profile
add the following
export MAVEN_HOME=/usr/local/maven/apache-maven-3.3.3
export PATH=${MAVEN_HOME}/bin:${PATH}
Save the file and exit (:wq)
to update the environment variable file to take effect immediately
[root@iZ94zsv4mnfZ ~]# source /etc/profile
5 Check if the installation is successful
[root@iZ94zsv4mnfZ ~]# mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: /usr/local/maven/apache-maven-3.3.3
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_102/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "amd64", family: "unix"
[root@iZ94zsv4mnfZ ~]#