You may like:

How to Install Gradle on Debian 10

Prerequisites

Login to your Debian system using shell access. For the remote systems connect over SSH connection. Run the below commands to upgrade the current packages to the latest version.

Step 1 – Install Java

Apache Maven required Java to be installed on your system. I have installed latest Java 11 on my Debian system using this tutorial.

Step 2 – Installing Maven on Debian

After the installation of Java. You are ready to install Apache Maven on Debian. Download the Apache maven archive file from its official website or use the following command to download Apache Maven 3.6.3. Extract the downloaded archive using the following command.

Step 3 – Configure Maven Environment

You need to set the M2_HOME and MAVEN_HOME environment variables to work with Maven on Debian. Also, set the bin directory to the PATH environment variable. You can set the environments variables by creating new file /etc/profile.d/apache-maven.sh. and add the following content. Now load the environment variables in the current shell using the following command.

Step 4 – Verify Installation

You have successfully installed and configured Apache Maven on your Ubuntu system. Use the following command to check the version of Maven. The Installation of Apache Maven on the Debian system has been completed successfully. You can now remove the downloaded archive file from your system to free space. To read more about Apache Maven visit here.