How to Install Maven latest version on Ubuntu Server Example

install-maven-on-ubuntu-18.10-vultr-vps-hosting--feature-image

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

Contents

Check Java Installation

Firstly, check Java:

$java -version
$echo $JAVA_HOME

install-maven-on-ubuntu-18.10-vultr-vps-hosting--check-java

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-on-ubuntu-18.10-vultr-vps-hosting--check-maven-installation

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 https://www-us.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz -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, MAVEN_HOME & PATH ->

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

– Now verification: mvn -version

install-maven-on-ubuntu-18.10-vultr-vps-hosting--check-maven-installation-latest-ver



By grokonez | December 3, 2018.


Related Posts


Got Something To Say:

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

*