How to Install Apache Maven on POP! OS

Apache Maven is a software project management tool that can manage a project's build, reporting, and documentation from a central piece of information. In this tutorial, we will learn how to install Apache Maven on POP! OS.

Prerequisites

Before starting this tutorial, you need the following:

Step 1 — Downloading Apache Maven

The first step is to download the latest version of Apache Maven from the Apache Maven website.

We will download the latest version by running the following command in the terminal:

wget https://mirrors.advancedhosters.com/apache/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz

This command will download the Apache Maven binaries to your system. If a newer version of Maven is available, replace the version number accordingly.

Step 2 — Extracting the Archive

After the download is complete, navigate to the directory where the file was downloaded using the cd command.

cd ~/Downloads/

Now, extract the archive using the following command:

sudo tar -xzvf apache-maven-3.8.1-bin.tar.gz -C /opt/

In this command, we are extracting the archive to the /opt directory using the -C option.

Step 3 — Setting up Maven Environment Variables

In this step, we will configure the environment variables for Apache Maven.

Open the .bashrc file in your home directory using the following command:

nano ~/.bashrc

Add the following configuration at the end of the file:

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

Save and close the .bashrc file using Ctrl + X, Y, and Enter keys.

Step 4 — Restarting the Terminal

In order to load the environment variables we set up, we will need to restart the terminal.

Simply close and reopen the terminal or run the following command:

source ~/.bashrc

Step 5 — Verifying the Installation

We can now verify the installation of Apache Maven by running the following command:

mvn -version

If the output shows the version of Apache Maven that you installed, then it means Maven is installed correctly.

Apache Maven 3.8.1
Maven home: /opt/apache-maven-3.8.1
Java version: 11.0.12, Vendor: Ubuntu, Runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.11.0-34-generic", arch: "amd64", family: "unix"

Conclusion

In this tutorial, we learned how to install Apache Maven on POP! OS. Now you are ready to use Apache Maven on your system.

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!