How to Install Apache Maven in Linux

Apache maven Install How to linux

Apache Maven is an opensource software is mainly used for Building the project, Managing the entire project’s Reporting & documentation features. Installing Apache Maven in Linux is easy Steps. Maven is used to build many number of projects at the same time with standard output types such as WAR, JAR, etc.

Lets see the Installation of Apache Maven in Linux,

Pre-Requisite is to have Java Installed in the machine, Please check by following command

# java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (amzn- u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)

If Java is not installed, Follow this blog to install java – How to Install Java JDK in Linux  

Step 1: Download the Apache Maven

From the official Site of Apache Maven using wget command or Click here to download the latest version,

# wget
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Saving to: ‘apache-maven-3.3.9-bin.tar.gz’
apache-maven-3.3.9-bin.tar.gz 100%[=================================>] 8.10M 3.26MB/s in 2.5s

Step 2: Extract the Tar.Gz File

Using tar command extract the file and delete the tar file to save disk space.

# tar -xvzf apache-maven-3.3.9-bin.tar.gz
# rm -f apache-maven-3.3.9-bin.tar.gz


Step 3: Set the Environmental Variables in the Path

copy the below lines and paste below in the bash profile file i.e /etc/bash.bashrc or in /etc/profile, These settings is for system wide,

export M2_HOME=/opt/apache-maven-3.3.9
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
# source /etc/profile

Ohaawayy… Installation of Apache Maven completes, Now we can check by issuing this command

# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.7.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.1.13-19.30.amzn1.x86_64", arch: "amd64", family: "unix"



Leave a Reply

Be the First to Comment!