Site icon TestingDocs.com

Install Maven on Ubuntu Linux

Overview

In this tutorial, we will go through the steps involved to install the Maven on the Ubuntu Linux machine. We will explore two options here.

#1 Install Maven using Linux native package

This option lets the user to choose the version and customize the install to chosen directory. This approach to install Maven for environment setup like for Software Automation needs to setup Maven home environment variables and add the Maven bin directory to the PATH environment variable.

Navigate to Maven official website.

https://maven.apache.org/download.cgi

Click on the Download button.

 

 

Choose Linux archive file and Download and Save the tar file on to the computer.

apache-maven-<version>.tar.gz

Extract the contents of the tar file.

$ tar -xvf <maven tar file location> 

Move the contents to a suitable location, For example to  /opt/maven

 

Set M2_HOME

Set the M2_HOME environment variable. Edit /etc/profile file and the variable.

M2_HOME=/opt/maven

PATH= $PATH:$M2_HOME/bin

export M2_HOME

export PATH

 

Verify the Install

Launch the Terminal.

$ echo $M2_HOME

$ mvn -version 

 

The version information should be displayed on successful Maven install.

#2 Install Maven using Package Manager

This option is less technical savvy. The install process is much simpler than the first option.

Launch terminal window

Execute the following command to install the tool.

$ sudo apt install maven

Type Y or y when prompted to install the tool.

Do you want to continue?

The installer would download all the required packages for the Maven tool.

Verification

Launch terminal window

Execute the following command to verify the Maven install.

$ mvn -version

That’s it. We are done with the Maven install on Ubuntu machine.

Install Maven on Windows

https://www.testingdocs.com/installing-apache-maven-3-x-on-windows-10/

Maven Tutorials on this website can be found at:
https://www.testingdocs.com/apache-maven-tutorial/

 

Exit mobile version