Skip to content

Instantly share code, notes, and snippets.

Created August 8, 2014 15:53
Star You must be signed in to star a gist
What would you like to do?
Install Maven with Yum on Amazon Linux
sudo wget -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
Copy link

thank you

Copy link

thank you man

Copy link

easikoglu commented Apr 26, 2018

I suggest you first download jdk from oracle website via wget, then install 1.8, after that set up environment variable in bash profile, as :
export JAVA_HOME=/usr/java/jdk1.8.0_171-amd64/
export JRE_HOME=//usr/java/jdk1.8.0_171-amd64/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

Then you do not need to deal with java version after executed in the upper gist.

Copy link

Very helpful, thank you.

Copy link

Thank you, very helpful

Copy link

Brilliant, thanks for this!

Copy link

Thank you very much.....:)

Copy link

Beautiful. Thanks man.

Copy link

Thanks Mister

Copy link

great thanks a lot

Copy link

helped me a lot!!!

Copy link


Copy link

raka755 commented Mar 18, 2019

Thanks a lot.It helps me.

Copy link

Perfect..!! .Thanks.

Copy link

Thanks a lot.....

Copy link

Appreciate you for sharing this. It worked like a charm :)

Copy link

Works Perfect...
Thank You!

Copy link

still is not working. i tried to check my PATH, echo $M2_HOME (it's invisible, not showing) does anybody have a suggestion?

Copy link

Thanks, @sebsto. This works on Amazon Linux 2.

Copy link

ram8283 commented Dec 6, 2019

perfect thank you so much

Copy link

thanks a lot 👍

Copy link

This worked great but set maven (and my default java) to use Java 1.7. If you want to use Java 1.8, follow the above gist and then do:

yum search java | grep openjdk
yum install java-1.8.<revision number from yum search>-openjdk-headless.x86_64
yum install java-1.8.<revision number from yum search>-openjdk-devel.x86_64
update-alternatives --config java #pick java 1.8
update-alternatives --config javac #pick java 1.8

Thank you so much!

Copy link


Copy link

You saved me a ton of time, thanks!

Copy link


Copy link


Copy link

mintavi commented Jul 9, 2021

Thanks!!!!!!! Works great.

Copy link

ro-rah commented Oct 28, 2021

This worked, thanks so much, you are legend!

Copy link

how we can update maven version on amazon ec2

Copy link

thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment