How to Install Maven on Ubuntu


A step by step guide on how to install Maven on Linux Ubuntu Operating Systems manually and from Command line.

Make sure Java JDK installation 1.7 or higher OR GraalVM for Java 8 or higher installed in your system and already set JAVA_HOME system path.

1. Install Maven on Ubuntu using apt

1.1. There are several ways you can install Maven on Linux. Run command sudo apt install maven to install Maven along with Java on Linux Ubuntu, it will get the latest maven distribution.

$ sudo apt install maven

1.2. Testing Installation:

$ mvn -version

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.7, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-40-generic", arch: "amd64", family: "unix"

2. Alternate way to install Maven on Linux Ubuntu

Make sure already Java JDK or GraalVM setup done on your Linux Machine.

2.1. Download binary tar archive from, extract it in your local system.

$ wget -P /home/ubuntuadmin/Documents/ ""
$ cd /home/ubuntuadmin/Documents/
$ tar xz -f apache-maven-3.6.3-bin.tar.gz

2.2. Create MAVEN_HOME variable and update $MAVEN_HOME/bin to PATH. To update them on Linux Ubuntu run following commands.

$ sudo nano ~/.bashrc     OR  sudo gedit ~/.bashrc  (on desktop version)

Include the following lines at the end to the .bashrc file.


2.3. Test the Maven Installation on Ubuntu using mvn -version.

install maven on ubuntu

3. Conclusion

In this guide we have seen how to install Maven on Ubuntu OS manually and from Command line. Did it work for you or any issue comment below.

Other Maven Setups:

  1. Install Maven on Windows
  2. Install Maven on Mac
  3. Import maven project into Eclipse
  4. Maven Skip Tests
  5. Maven run single test
  6. Maven set java version
  7. Maven run java main class

4. References

  1. Apache Maven
  2. Install GraalVM on Ubuntu


Please enter your comment!
Please enter your name here