How to Install Maven™ on Windows and Ubuntu

The process of building and managing any Java-based project was never that simple before the advent of Maven™. Maven is a robust project management tool based on the Project Object Model (POM) that helps you download dependencies needed in the project. 

Install Maven on Windows

First, we need JDK (Java development kit) installed in our system, which is then followed by installing Maven on Windows. 

Let's begin with opening the chrome browser and searching for “JDK 8 download.” There will be a link to Oracle. 

Navigating to that page, you’ll find the JDK for different platforms and operating systems. 

Install the Windows x64 version.


Then, as the login page appears on the screen, log in to your account. As this is being done, you’ll see that the .exe file is being downloaded.

While Java is being installed, let's begin with the process to install Maven on Windows:


Once both JDK and Apache Maven are downloaded, we’ll open the directory where the Java executables are. 

Install the complete JDK. 


After installing the JDK, we need to go to the Maven directory and extract the files.


The file we get can be renamed and placed in the C drive, and that will be the Maven home path we’ll use.

Then do the following:

  • Go to the system properties
  • In the system properties, go to the advanced system settings option
  • In the dialog box that appears, go to the environment variables to set the path 


The next step is to open the CMD prompt.

In the command prompt, type the command to check the Java version:

java -version

The version of Java appears on the screen.

Then come back to the dialog box and click on new, to set up a new environment variable.

In the name, enter MVN_HOME. In the variable value, paste the Maven directory location in the C drive.


Then, in the path variable, we have to add the bin directory.


Press OK on all the dialog boxes.

The Maven installation is done. To confirm that Maven is installed, go back to the command prompt window.

Check the Java version: 

java -version

Followed by the Maven version:

mvn -version


Here, we can see both JDK and Maven installed on our system.

Now it's time to install Maven on Ubuntu.

Learn Concepts - Basics to Advanced!

Caltech Program in DevOpsExplore Program
Learn Concepts - Basics to Advanced!

Install Maven on Ubuntu

In this process, we’ll install both JDK and Maven on Ubuntu.

  • Open the terminal
  • Log in to the root id to install packages 
  • After the above process is done, run the app update command
  • Next, install the latest package of Java 

install oracle -java14 -installer

While this happens, let's download Maven.

  • Go back to your browser
  • Search for “Maven download” or go straight to
  • Go to the Binary tar.gz archive
  • Copy the link of the Binary tar.gz archive 


Let's go back to the terminal and check on the Java download. 

After the installation is done, open a new terminal to install Maven.

In the new terminal, go to the opt directory 

cd /opt

Then run the wget command along with the link copied above.

wget *link of tar.gz archive*


When the Maven tar file is downloaded, extract that file.

tar -xvzf *tar file name*


After the extraction has finished, we can see the Apache Maven directory.

Now, rename the directory. To rename it, use the move command to go to the actual folder.

mv *apache-maven folder*

Now let's go to the Maven directory. 

cd maven/


Now go back to terminal 1 and check the Java version. 

java -version


Coming back to terminal 2:

cd/ etc/ profile.d/


We can see all the path variables here.

To add some more parameters, use the echo command so the path variables can be copied:

echo *path copied* /opt/maven/bin >>


Now, export MVN_HOME here.

echo “export MVN HOME=/opt/maven” >>


In the end, we’ll give executable permissions to this file.

chmod +x

The last step is to run the source command: 

source /etc/profile.d/

After this command, we can run the Maven version command:

mvn -version


Here, we can check the version of Maven, and this is how we can configure Maven on our Ubuntu virtual machine.

Are you skilled enough for the role of a DevOps Engineer? Try answering these DevOps MCQ Questions and find out now!

Become a DevOps Expert

Preparing for a career in DevOps? Simplilearn's DevOps Certification Training Course bridges the gap between software developers and operations. You’ll become an expert in continuous development and deployment, automation of configuration management, cross-team collaboration, and IT service agility, using modern DevOps tools such as Git, Docker, Jenkins, Puppet, and Nagios. Start on your path today.

About the Author

Ishan GabaIshan Gaba

Ishan Gaba is a Research Analyst at Simplilearn. He is proficient in Java Programming, Data Structures, and Project Management. Graduated in Information Technology, Ishan is also passionate about writing and traveling.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.