First of all download the maven tar into the environment. Below I have show the command to download maven 3.5.0
Now Apache maven tar binary will be downloaded to where you execute above command. Then untar the binary file using below command
tar -xvf apache-maven-3.5.0-bin.tar.gz
Now we are going to set up maven for you. You can copy unzipped folder to where ever you want it to be. My case I will create a folder called usersettings and move the maven folder into usersettings folder.
Now need to set up path variables for M2_HOME and M2 variables like below
And attach JVM memory for maven process like below
Now you are ready to go and you can just type mvn -version or mvn to test maven successfully set up on your environment