How to install Maven in Centos

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.

This article explains the steps to install Maven in Centos server.

Step1: Make sure that Java development kit (JDK) is installed in the system.

#java -version

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

Step2: Change the location

#cd /usr/local

Step3: Download Apache Maven source code

#wget http://www-eu.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz

Step4: Extract the downloaded file.

#tar xzf apache-maven-3.5.3-bin.tar.gz

Step5: Configure link to the folder

#ln -s apache-maven-3.5.3 maven

Step6: Configure environment variables in the file /etc/profile.d/maven.sh. Add the below lines to the file and save.

export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}

Step7: Load the environment variables

#source /etc/profile.d/maven.sh

Step8: Check Maven version

#mvn -version

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
Maven home: /usr/local/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_161/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-93-generic", arch: "amd64", family: "unix"

 

That's all.......

Leave a Reply

Your email address will not be published. Required fields are marked *