HowTo: Installain apache-maven in CentOS

Posted on

If you need to install in  Fedora, CentOS, Red Hat or Scientific Linux sometimes yum does not have the package for the product, if you would like to install the below steps will help.

What is Maven: Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

More info here :

Downloads :

Java should be install and add as system binary.

Java Installation :

Download Maven and untar it.

The first thing we need to do is to download the Maven tar file and untar it to a shared location on the workstation


tar -zxvf apache-maven-3.2.3-bin.tar.gz -C /usr/local

Setup the Maven Environment Variables in shared profile.

The next step is to setup the Maven environment variables in a shared profile so all users on the system will get them import at login time.

vi /etc/profile.d/

# Add the following lines to
export M2_HOME=/usr/local/apache-maven-3.2.3
export M2=$M2_HOME/bin PATH=$M2:$PATH

Now test your install of Maven.

Logout of the system and then log back into it. Enter the following command:

[root@Dev-Web installer]# mvn -version

If you did everything right your output should look something like the one below:

Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T20:58:10+00:00)
Maven home: /usr/local/apache-maven-3.2.3
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.0.1.el6.x86_64", arch: "amd64", family: "unix

Now that’s it. have fun with maven.