How do I install Maven on CentOS

+1 vote
How do I install Maven on CentOS?
Feb 19, 2019 in Other DevOps Questions by Nagraj
7,831 views

1 answer to this question.

+2 votes

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
answered Feb 19, 2019 by Nishant

Related Questions In Other DevOps Questions

0 votes
1 answer

How do I install Maven on Windows?

Hey @Laksha, to install Apache Maven all ...READ MORE

answered Feb 19, 2019 in Other DevOps Questions by Kashish
1,079 views
0 votes
1 answer

How do I install maven on ubuntu?

Hey @Kiran, Installing Maven on Ubuntu is ...READ MORE

answered Feb 19, 2019 in Other DevOps Questions by Jobin
1,470 views
0 votes
0 answers

How do I add the azure-devops commands to the Azure CLI in an offline on-premise server?

I wanted to add the azure-DevOps extension to the Azure ...READ MORE

Apr 19, 2022 in Other DevOps Questions by Kichu
• 19,040 points
592 views
0 votes
1 answer

How do I share Build Definitions across Projects in Visual Studio Online?

VSTS does not support sharing build definitions ...READ MORE

answered Jul 5, 2018 in Other DevOps Questions by DareDev
• 6,890 points
559 views
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
1,206 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,058 views
0 votes
1 answer

How do I preserve local ivy repository in Bluemix BUILD & DEPLOY?

You're right--the pipeline spins up a new ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by Atul
• 10,240 points
621 views
0 votes
1 answer

Install Nginx on Linux

Hey @Rishi, follow these steps: sudo apt-get update sudo ...READ MORE

answered May 15, 2019 in Other DevOps Questions by Iliana
842 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP