HostSEO Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog

How to Install Apache Maven on CentOS 7

Maven is a automation tool used to build and manage projects written in C, ruby language, In this blog, I will explain that how to install and configure latest version of Apache Maven on a CentOS 7.


CentOS 7 Server
Root privileges

# steps:

Install Java OpenJDK on CentOS 7
Download Apache Maven Binary Files from source file
Configure Apache Maven Environment on centos

First. You need to install the Java on the CentOS 7 server. The apache Maven requires JDK 1.7 or above. So, please install the java software package “java-1.8.0-openjdk-devel “on this server.

# yum install -y java-1.8.0-openjdk-devel
# java -version

If installation is success, you see the following output.

# java -version
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (build 1.8.0_201-b09)
OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)

Please download Apache maven from its official website or use following link to download Maven 3.5.4. package to directory /usr/local/src

# cd /usr/local/src
# wget

After that, extract downloaded file using following command.

# tar -xf apache-maven-3.5.4-bin.tar.gz
# mv apache-maven-3.5.4/ apache-maven/ 

To configure the environments variables to Apache Maven files, you need to create file ‘’ in the ‘/etc/profile.d’ directory

# cd /etc/profile.d/
# vim

Add the following configuration in file

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

To load the added configuration by using the ‘source’ command.

# chmod +x
# source /etc/profile.d/

After that, you need to check that Apache Maven installation is successfully or not , run the following maven command.

# mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /usr/local/src/apache-maven
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8.0-openjdk-
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-43-generic", arch: "amd64", family: "unix"

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar


Born in 2004 ... Trusted By Clients n' Experts

SEO Stars

They never made me feel silly for asking questions. Help me understand how to attract more people and improve my search engine ranking.

Read More

Emily Schneller Manager at Sabre Inc
SEO Stars

Took advantage of Hostseo's superb tech support and I must say, it is a very perfect one. It is very fast, servers reliability is incredible.

Read More

Leena Mäkinen Creative producer
SEO Stars

We're operating a worldwide network of servers with high quality standards requirements, we’ve choose hostseo to be our perfect partner.

Read More

Ziff Davis CEO at Mashable
SEO Stars

It’s very comfortable to know I can rely about all technical issues on Hostseo and mostly that my website and emails are safe and secured here.

Read More

Isaac H. Entrepreneur
SEO Stars

With hostseo as a hosting partner we are more flexible and save money due to the better packages with great pricing, free SEO n' free SSL too!

Read More

Madeline E. Internet Professional