Because Maven is a Java-based programme, the first need is for you to have JDK installed.
Open the terminal and run the java command shown below.
Verify all the operating systems’ output.
Install the Java Software Development Kit (SDK) from https://www.oracle.com/technetwork/java/javase/downloads/index.html if you don't already have it.
Set the JAVA HOME environment variable to the place where Java is installed on your machine's base directory. For example −
Appending the Java compiler location on the System Path.
Verifying the Java Installation via java -version command as described above.
Downloading the Maven 2.2.1 via https://maven.apache.org/download.cgi.
Install Maven 3.3.1 in the directory where you extracted the download. The archive will be used to build the apache-maven-3.3.1 subfolder..
Adding M2, MAVEN_OPTS, M2_HOME, to the environment variables.