How to Install Maven latest version on Ubuntu Server Example


In the tutorial, we show you how to install Maven in Ubuntu Server.

Related post:
How to install Java in Ubuntu Remote Server – Vutr Hosting VPS Example


Check Java Installation

Firstly, check Java:

$java -version
$echo $JAVA_HOME


Related post if Java is NOT installed ->

How to install Java in Ubuntu Remote Server – Vutr Hosting VPS Example

Install Maven with APT

Updating the package index:

sudo apt update

Install Maven by cmd:

sudo apt install maven

Verify the Maven installation by cmd:

mvn -version


Install Maven Latest Version

The lastest version of Maven when creating the post is 3.6.0. But the Maven package index by APT is just 3.5.4.

So for the lastest version of Maven, we need install Maven from Downloading Apache Maven

– Download Apache Maven ->

wget -P /tmp

– Extract the archive in the /opt directory ->

sudo tar xf /tmp/apache-maven-3.6.0-bin.tar.gz -C /opt

– Create a symbolic link maven which will point to the Maven installation directory:

sudo ln -s /opt/apache-maven-3.6.0 /opt/maven

-> For upgrade Maven installation, just simply unpack the newer version and change the symlink to point to the latest version.

– Setup Maven Environment Variables:


export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

– Now verification: mvn -version


By grokonez | December 3, 2018.

Related Posts

Got Something To Say:

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