How Do You Install Maven on Linux?

Problem scenario
How do you install Apache Maven on any distribution of Linux?

Solution
This is based on Apache Maven 3.6.3.*

mavenversion=3.6.3
curl http://mirrors.advancedhosters.com/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz > /tmp/apache-maven-$mavenversion-bin.tar.gz
#curl http://mirrors.advancedhosters.com/apache/maven/maven-3/$mavenversion/binaries/apache-maven-$mavenversion-bin.tar.gz > /tmp/apache-maven-$mavenversion-bin.tar.gz
cd /tmp/
sudo tar -xzvf apache-maven-$mavenversion-bin.tar.gz
sudo mv apache-maven-$mavenversion /opt/maven
export M2_HOME=/opt/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
source ~/.bashrc
mvn -v

*You can change the directions if you want. You can get the latest installation media from here:
https://maven.apache.org/download.cgi

Leave a comment

Your email address will not be published. Required fields are marked *