Skip to content

Instantly share code, notes, and snippets.

@sebsto
Created August 8, 2014 15:53
Show Gist options
  • Save sebsto/19b99f1fa1f32cae5d00 to your computer and use it in GitHub Desktop.
Save sebsto/19b99f1fa1f32cae5d00 to your computer and use it in GitHub Desktop.
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -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
@Mayuri240999
Copy link

1)firstly, you have to install java on amazon Linux

sudo dnf install java-17-amazon-corretto -y
 java --version

2)Then install maven

 sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -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
  1. then set the path for maven , add these lines in ~/.bashrc file
PATH="$PATH:<DIR WHERE YOU RAN ABOVE COMMANDS>/apache-maven-3.5.2/bin"
M2_HOME=<DIR WHERE YOU RAN ABOVE COMMANDS>/apache-maven-3.5.2

DIR WHERE YOU RAN ABOVE COMMANDS :- there default path is /usr/share/apache-maven
after that exit the editor and give command to see maven installed version

mvn -v

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