Hey @Nagraj,
Follow these steps to install Maven on CentOS:
Install JDK
yum install -y java-1.8.0-openjdk-devel
java -version
Go to a folder where you want to install Maven and then execute the following command:
# wget http://www-us.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
Extract the downloaded file and rename it using the following commands:
tar -xf apache-maven-3.5.4-bin.tar.gz
# mv apache-maven-3.5.4/ apache-maven/
Configure the Environment variables by creating maven.sh in /etc/profile.d and add the following configurations:
# Apache Maven Environment Variables
# MAVEN_HOME for Maven 1 - M2_HOME for Maven 2
export M2_HOME=/usr/local/src/apache-maven
export PATH=${M2_HOME}/bin:${PATH}
Now make this file executable and then load the configurations
# chmod +x maven.sh
# source /etc/profile.d/maven.sh
Check the version you've installed with the following command:
# mvn --version