You need Java JDK installed, see this link Install Java JDK 1.8
Download the package from: maven.apache.org
Move the compressed archive to the location you want and extract.
cd /opt wget http://www.eu.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.zip unzip apache-maven-3.3.3-bin.zip mv apache-maven-3.3.3 maven
Create the following symlink: (note: /opt/maven is where I extracted the archive on this server)
ln -s /opt/maven/bin/mvn /usr/bin/mvn
Create a file maven.sh under /etc/profile.d/ and fill it with the following based on where you extracted the maven archive.
#!/bin/bash MAVEN_HOME=/var/maven PATH=$MAVEN_HOME/bin:$PATH export PATH MAVEN_HOME export CLASSPATH=.
Make this file executable:
chmod +x /etc/profile.d/maven.sh
Issue the following to make the variables permanent:
Reboot. Issue the following to verify that it’s correctly installed:
You should see something like the following to signal that it’s successfully done:
Java version: 1.8.0_51, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.8.0-openjdk-22.214.171.124-3.b16.el6_7.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-573.7.1.el6.x86_64", arch: "amd64", family: "unix"