How to Install Apache Maven on Linux Mint Latest

Apache Maven is a widely-used software project management tool for Java-based applications that automates the building, testing, and deployment of software packages. In this tutorial, we will walk you through the steps of installing Apache Maven on Linux Mint.

Prerequisites

Step 1: Update the System

Before getting started with Maven installation on Linux Mint, it's a good idea to update the system with the latest packages. Run the command below in your terminal to update your system:

sudo apt-get update

Step 2: Install Maven

By default, Apache Maven is not available in the official repositories of Linux Mint, but it can be easily installed from the binary distribution. Follow these steps to install Apache Maven:

Step 2.1: Download Maven

Navigate to the Apache Maven download page and download the latest version of Maven by clicking on the link that says apache-maven-x.x.x-bin.zip.

Step 2.2: Extract the Maven Package

Once the download is complete, open your terminal and navigate to the directory where you downloaded the Maven package with the following command:

cd ~/Downloads

Extract the contents of the downloaded file with the following command:

unzip apache-maven-x.x.x-bin.zip

Replace x.x.x with the version number of the package you've downloaded.

Step 2.3: Move the Maven Package

Once you've extracted the Maven package, move it to the /opt/maven directory using the following commands:

sudo mv apache-maven-x.x.x /opt/maven

Step 2.4: Set up Environment Variables

To set up the environment variables for Apache Maven, create a new configuration file in the /etc/profile.d/ directory using the following command:

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

Add the following lines to the maven.sh file:

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

Save and close the file by pressing CTRL + X, Y, then ENTER.

Activate the environment variables in the current session by running the following command:

source /etc/profile.d/maven.sh

Step 3: Verify the Installation

Once you have completed the above steps, you can verify the successful installation of Apache Maven by checking its version with the following command:

mvn -version

If it is installed successfully, you should see the Maven version information printed on your terminal.

Congratulations! You've successfully installed Apache Maven on your Linux Mint machine. You can now start using Maven for building, testing and deploying your Java-based applications.

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!