How to Install Apache Maven on Ubuntu 22.04
Before installing Apache Maven, your system must meet the following requirements:
- User with sudo privileges
- OpenJDK 1.7 or above installed on your computer or virtual private server
- SSH client if you are using VPS services
Users can install Apache Maven using the Advanced Package Tool (APT) or through the official Apache Maven website.
Let’s start with the APT method.
Install Apache Maven on Ubuntu 22.04 Using APT
The official Ubuntu repositories contain Maven packages by default. Thus, the most convenient way to install Apache Maven is by using the APT package manager.
However, the Maven package version in Ubuntu repositories may differ from the official one. It may also not be the latest release.
Update the package index with the following Linux command:
sudo apt-get updateInstall OpenJDK:
sudo apt install default-jdkVerify the installation by running the following command:
java -version
Install Maven using the command below:
sudo apt-get -y install mavenThe default Maven installation directories are /usr/share/maven and /etc/maven. Verify the Apache Maven version using the following command:
mvn -version
If you see a similar window, you’ve successfully installed Apache Maven on your machine.

