Dear Sunil,

Greetings !

We hope you are using amazon Linux ec2 instance. The instructions for this will be changing or little different sometimes.

Please try with the below commands ( Downloading maven, extracting,changing directory,setting path)

*above command you are downloading the file

sudo tar -xzvf apache-maven-3.2.1-bin.tar.gz

*above command you are extracting the downloaded file

sudo mv /home/ec2-user/apache-maven-3.2.1 /usr/local/maven

*above command you are moving the extracted file to another location

sudo ln -s /usr/local/maven/apache-maven-3.2.1 /usr/local/maven/current

sudo vim ~/.bashrc

(*Incase vim did not work, please try with vi (or) nano. All these are text editors )

export MAVEN_HOME=/usr/local/maven/current
export M2_HOME=/usr/local/maven/current
export M2=/usr/local/maven/current/bin
export PATH=/usr/local/maven/current/bin:$PATH

*these above lines, you should add in .bashrc file which means you are setting path of maven

source ~/.bashrc
*this above command reloads the .bashrc file and saves the changes

mvn -version

*This above command should show you the version of installed maven and details.

Let us know if you need any further help.

Yeshwanth at Edureka
edureka! Support Team