How to Install Apache Maven on Debian Latest

Apache Maven is a powerful build automation tool which is used to manage, build, and deploy any Java-based project. In this tutorial, we will guide you on how to install Apache Maven on Debian Latest.

Prerequisites

Before starting the installation process, make sure that your system is up-to-date and has the following packages installed:

If JDK is not installed, then run the following command to install it:

sudo apt-get install default-jdk

Step 1 - Downloading Apache Maven

First, you need to download Apache Maven from their official website. The latest version of Apache Maven can be downloaded from the following link:

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

Once downloaded, navigate to the directory where the downloaded file is saved.

Step 2 - Extracting the Maven Package

After the download is complete, unzip the downloaded file using the following command:

tar -xzvf apache-maven-*.tar.gz

This will extract the Maven package and create a directory with the name "apache-maven-*".

Step 3 - Setting the Environment Variables

Next, you need to set the environment variables for Apache Maven. To do this, open the configuration file for the environment variables:

sudo nano /etc/profile.d/maven.sh

Then, add the following lines of code to the file:

export M2_HOME=/opt/apache-maven-*
export PATH=$PATH:$M2_HOME/bin

Note: Replace * with the version number of the Maven package you have downloaded.

Save and exit the file by pressing Ctrl+X, then Y, and finally Enter.

To apply the changes made in the above file, run the following command:

source /etc/profile.d/maven.sh

Step 4 - Verifying the Installation

Finally, to check if everything is configured properly, run the following command in the terminal:

mvn -version

This will display the version of Apache Maven installed on your system.

Conclusion

In this tutorial, we have explained how to install Apache Maven on Debian Latest. Now you are all set to build and deploy any Java-based project using Apache Maven.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!