How to Install Apache Maven on Ubuntu 18.04 Bionic Beaver

Install Apache Maven on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Apache Maven on Ubuntu 18.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 free and open source, software project management and comprehension tool written in Java. Based on the concept of a project object model (POM), Maven can manage an entire project’s build. With Maven you can easily store documents, generate reports and documentation from a central piece of information.

Install Apache Maven on Ubuntu

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.

Install the Java package by typing:

Verify the Java installation:

Step 3. Install Apache Maven.

  • Install Maven from the official Ubuntu repository:

So currently installed is version 3.6.1. Note that the latest available version of Apache Maven is currently 3.6.1 and it is recommended version for all users. To proceed with the installation, run the following command:

After the installation is complete, you can verify whether Maven is successfully installed on your Ubuntu:

  • Install Maven from the official source:

Download the latest stable version of Maven or use the below command to download the Apache Maven v3.6.1 using the terminal:

We will create a symbolic link maven which will point to the Maven installation directory:

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

Make the script executable by typing:

Finally load the environment variables using the following command:

Check whether the Apache Maven has been successfully configured on your system using the below command:

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