How do I install Maven on CentOS?

0 votes
How do I install Maven on CentOS?
Feb 19 in Other DevOps Questions by Nagraj
245 views

1 answer to this question.

0 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 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 in Other DevOps Questions by Kashish
49 views
0 votes
1 answer
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,810 points
37 views
0 votes
1 answer

how do i make apache2 site point outside the folder in ubuntu?

in apche2 configuration file u have to ...READ MORE

answered Jul 6, 2018 in Other DevOps Questions by Kalgi
• 45,870 points
42 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
101 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
250 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
42 views
0 votes
1 answer

Install Nginx on Linux

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

answered May 15 in Other DevOps Questions by Iliana
50 views