How to Install Apache Maven on Debian 11 Bullseye

Download the latest version of Apache Maven to install on Debian 11 Buslleye Linux server or desktop using the command line terminal.

Apache Maven is an open-source automation tool similar to Ant and Gradle for automating and simplifying many of the procedures that occur over and over again in software development. It is sometimes referred to as the “Build Management System” and is part of the “Software Configuration Management ( SCM )”. While Ant is more command-oriented, Maven is more strategically oriented suitably for more complex multi-module projects.

Managed by Apache foundation, Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other programming languages.  Here, we will learn the commands to install Apache Maven on Linux Debian 11 Bullseye distro.

Steps to install Apache Maven on Debian 11

There are two ways to install Apache Maven on Debian 11, one is using its APT package manager and the other is by directly downloading its latest tar file. However, using APT, the version will not be the latest one.

#1st method:

Update system repository cache

To get the packages from the APT package manager, it is recommended to run first the system update command. This will refresh the APT cache and also install available security updates.

sudo apt update
sudo apt install wget -y


Install Apache Maven on Debian 11 using APT

Next, as one of the stable but not the latest version is available to install using Debian’s system repository via the APT package manager, hence to get that use the given command:

sudo apt install maven


Check the Maven version

Once the installation is completed, to confirm the Apache Maven has been installed successfully on Debian 11 check its version.

maven --v


Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.13, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-9-amd64", arch: "amd64", family: "unix"


#2nd Method

The other method is manually downloading the latest Maven files and configuring them to use on Debian 11 Bullseye. Here is how to do that?

Install OpenJDK on Bullseye

If you are going for manual installation then we also have to configure Java. The default version available in Debian 11 is OpeJDK-11 which is compatible with Apache Maven’s latest version.

sudo apt install default-jdk


Get Apache Maven’s latest Tar file for Debian 11

The user can directly visit the Apache Maven download page and get the latest version available there. Or use the given command:

Note: While doing this article the latest version was 3.8.4 and may differ in your case. Hence, check out the above-given link first.


Extract the file:

tar -xvf apache-maven-*-bin.tar.gz

Check the extracted file:


Move it to /usr/share/

sudo mv apache-maven-3.8.4 /usr/share/maven

Note: Change apache-maven-3.8.4 in the above command with the name of your extracted folder.


Add the Maven folder to the System path

To use the maven command tool from anywhere in your terminal add its folder path in your bash profile.

echo 'export PATH="$PATH:/usr/share/maven"' >> ~/.bashrc
echo 'export PATH="$PATH:/usr/share/maven/bin"' >> ~/.bashrc

Reload Bash profile:

source ~/.bashrc


Check MVN version

Now, to check the command line tool MVN of Apache Maven is working fine, print its version.

mvn -v

This time you get the following output:

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /usr/share/maven
Java version: 11.0.13, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-9-amd64", arch: "amd64", family: "unix"


Create your first project

Well, those who are familiar with Maven would already know what to do for creating a project, whereas the new ones can check out the official Apache Maven website documentation to know more about it. Nevertheless, just to give an idea of how to start with this tool, here are the commands:

Create a project

Paste the given commanding your terminal. You replace the group ID, artifact ID, and other values as per your choice.


mvn archetype:generate -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false


Switch to your create app project directory, here it is as per the above command- myapp

cd myapp


mvn package

Create Apache Maven demo project debian 11

To test the newly compiled Jar files:

java -cp target/myapp-1.0-SNAPSHOT.jar

Check Apache Maven project demo output

To create a site using POM.XML, run the given command inside your app directory:

mvn site

Once done, run

firefox target/site/index.html

Install Apache Maven App site on Debian 11 Bullseye


Other Articles:

Steps to Install and start with Dash on Debian 11 Bullseye
How to install MySQL 8.0 Server on Debian 11 Bullseye
Commands to Install Xrdp Server on Debian 11 Bullseye…
How to Install PuTTY on Debian 11 Bullseye
Install Jenkins on Debian 11 Bullseye



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.