How to install Apache Maven on CentOS (& other Linux distros)

Apache Maven is an open source build automation tool that is mainly used for creating JAVA based projects. Though used mainly for java projects, Apache maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.

To build a project, an XML file is described for the software project being built, its dependencies on other external modules and components, the build order, directories, and required plug-ins. It comes with pre-defined targets for performing certain well-defined tasks such as compilation of code and its packaging.

In this tutorial, we will learn to install Apache Maven on CentOS/RHEL systems. Using the same procedure mentioned below, we can also install Apache Maven on other Linux distributions like Ubuntu, Debian, Fedora etc.

Pre-requisites

We need to JAVA 1.7 or above to be installed on the system to run Apache Maven. You can check the installed Java version with the following command,

$ java –version

If java is not installed on your machine, please go through our detailed tutorial on how to install Java on your Linux machine. Once java has been installed, we can proceed ahead to install Apache Maven.

Installation

Firstly download the latest version of Apache Maven on your system by executing the following command from your terminal,