How to Install Apache Maven on Ubuntu 20.04

Install Apache Maven on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Apache Maven on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Apache Maven is an open-source project management software and comprehension tool used primarily for Java projects. Maven is built based on the concept of a project object model (POM), Maven can manage a project’s build, configuration details, the project’s dependencies, reporting and documentation from a central piece of information.

Install Apache Maven on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Java.

We install the Java OpenJDK, run the commands below:

Verify our Java version installed on our system:

Step 3. Install Apache Maven on Ubuntu system.

In this step, we will download the apache maven binary code using the wget command:

Next, run the commands below to extract the downloaded package:

After the file has been extracted, the files will be located on /home/ramona/apache-maven_3.6.3 directory. then we will create a symbolic link:

Then, set the necessary environment variables by creating a new file with the following content:

Make the script executable by typing:

Finally, load the environment variables using the following command:

Now run the commands below to check the version number:

That’s all you need to do to install Apache Maven on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.