Would you like to learn how to do an Apache Maven installation on Ubuntu Linux? In this tutorial, we are going to show you how to download and install Apache Maven on a computer running Ubuntu Linux.

• Ubuntu 18.04
• Ubuntu 19.04
• Ubuntu 19.10
• Apache Maven 3.6.2
• Openjdk version 11.0.4

Hardware List:

The following section presents the list of equipment used to create this Apache Maven tutorial.

Every piece of hardware listed above can be found at Amazon website.

Apache Maven - Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Apache Maven.

Tutorial Apache Maven - Installation on Ubuntu Linux

Install the Java JDK package.

Copy to Clipboard

Use the following command to find the Java JDK installation directory.

Copy to Clipboard

This command output should show you the Java installation directory.

Copy to Clipboard

In our example, our Java JDK is installed under the folder: /usr/lib/jvm/java-11-openjdk-amd64

Now, you need to create an environment variable named JAVA_HOME.

Let’s create a file to automate the required environment variables configuration

Copy to Clipboard

Here is the java.sh file content.

Copy to Clipboard

Reboot the computer.

Copy to Clipboard

Use the following command to verify if the JAVA_HOME variable was created.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Use the following command to test the Java installation.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Download the Apache Maven package from the official website.

Copy to Clipboard

Install the Maven software on your Linux server.

Copy to Clipboard

Now, you need to create the following Apache environment variables:  M2_HOME and MAVEN_HOME

Let’s create a file to automate the required environment variables configuration

Copy to Clipboard

Here is the maven.sh file content.

Copy to Clipboard

Reboot the computer.

Copy to Clipboard

Use the following command to verify if all the required environment variables were created.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Test your Apache Maven installation

Copy to Clipboard

This command will verify the Apache Maven version installed.

Copy to Clipboard

The Apache Maven installation was successfully completed.