In this tutorial, I am going to show how to install Maven on Ubuntu.

Maven on Ubuntu 14.x :

Unlike installing the maven on windows, it is not necessary to download the maven zip from external resources. We can easily install the maven using basic Linux commands.

Steps to install Maven on Ubuntu :

Follow the below steps.

Step – 1 :

Open the terminal bypassing the below command :

Ctrl+alt+t

Step – 2 :

Search for Maven packages on your machine bypassing the below command :

apt-cache search maven

Probably you can see the below text on your end of the terminal.

maven - Java software project management and comprehension tool
maven-ant-helper - helper scripts for building Maven components with ant
maven-debian-helper - Helper tools for building Debian packages with Maven
maven-repo-helper - Helper tools for including Maven metadata in Debian packages
testng - testing framework for Java

Step-3 :

Install the latest maven on Ubuntu by passing the below command to your terminal.

sudo apt-get install maven

It will ask your sudo password and then ask to confirm the continuation. After confirming it will take few minutes to download and set up.

Step-4 :

After completion of the above step, we can test it by knowing the maven version. To get the maven version you can pass the below command.

mvn -version

$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-71-generic", arch: "amd64", family: "unix"

If you see the above information you can confirm that maven has successfully been installed on your Ubuntu machine.

Happy Learning 🙂