Install Maven in Linux

Installing apache maven in linux(Ubuntu).

Make sure you have java installed already in you machine. You could check it running following command: java -version

You should see something like this:

$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Apache maven:

Maven is a project and build management tool which is working based on the concept called POM-Project Object Model. Maven can manage a project’s build, reporting and documentation from a central piece of information.

Maven provides developers a complete build lifecycle framework. Development teams can automate the project’s build infrastructure in less time as Maven uses a standard directory layout(see maven project directory structure.) and a default build lifecycle.

In case of multiple development teams environment, Maven can set-up the way to work as per standards in a very short time. As most of the project setups are simple and reusable, Maven makes life of developer easy while creating reports, checks, build and testing automation setups.

Maven provides developers ways to manage following:

Builds, Documentation, Reporting, Dependencies, SCMs, Releases, Distribution, mailing list

To summarize, Maven simplifies and standardizes the project build process.

To install maven in ubuntu follow the below steps:

$ sudo apt-get install maven

It will install latest maven, check the installation by running the following command:

$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-45-generic", arch: "amd64", family: "unix"

You can also install by downloading the zip file from maven website and do it manually, in that case, you will have to set the environmental variable m2_home manually.

Please follow the below steps:

Visit to and check what is the latest tar.gz file.
When you want e.g. apache-maven-3.2.1-bin.tar.gz, from the command line; you should be able to simply do:


And then proceed to install it.
Run command above from the dir you want to extract maven to (e.g. /usr/local/apache-maven)
run the following to extract the tar:
tar xvf apache-maven-3.2.1-bin.tar.gz
Next add the env varibles such as
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

Please verify the installation as:
mvn -version

Leave a Reply

Your email address will not be published. Required fields are marked *