1- Download Maven library from the following URL http://maven.apache.org/download.html. At the time of writing this tutorial the latest version of Maven is 2.0.9. Download apache-maven-2.0.9-bin.zip for Windows and apache-maven-2.0.9-bin.tar.gz from Linux platform.
2- Unzip the file at some proper location (in my case its C:\Program Files\Apache Software Foundation\apache-maven-2.0.9).
3- Make sure your JAVA_HOME environment variable is set to java home directory.
4- You need to setup two environment variables for Maven
a. M2_HOME
b. M2
For Windows:
Go to My Computer > Properties >Advance tab > Environment variables > Under User variables > New and provide both M2_HOME and M2 environment variables as shown in the following figures
5- You also need to update the PATH environment variable in order to access Maven commands from console. Go to My computer > properties > Advance tab > Click Environment Variable Button > under system variables find PATH variable > Click Edit and at the end provide the path up to the bin folder of Maven. In my case it is C:\Program Files\Apache Software Foundation\apache-maven-2.0.9\bin
6- To verify that every thing is setup according to the plan open console and type mvn –version. You should see something similar to the following figure.