Atlantic.Net Blog

How To Install Apache Maven On Fedora

Apache Maven is an open-source project management tool used for managing Java projects. Using Maven, you can manage the project’s reporting, build, and documentation from a central place. It can also manage written projects in languages such as C#, Ruby, Scala, etc. It is based on the POM model and hosted by the Apache Software Foundation.

This post will show you how to install Apache Maven on Fedora.


  • A server running Fedora 34 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Next, create a new server, choosing Fedora 34 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Java JDK

Apache Maven is a Java-based software, so Java must be installed on your server. If not installed, you can install it using the following command.

dnf install java-11-openjdk -y

After installing Java JDK, you can verify the Java installation using the following command.

java --version

You should see the Java version in the following output.

openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment 18.9 (build 11.0.15+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+10, mixed mode, sharing)

Step 3 – Download and Install Apache Maven

First, visit the Apache Maven official website, pick the latest version of Maven, and download it with the following command.


Once the download is completed, extract the downloaded file with the following command.

tar -xvzf apache-maven-3.9.1-bin.tar.gz

Next, move the extracted directory to the /opt directory.

mv apache-maven-3.9.1 /opt/maven

Step 4 – Create an Environment Variable for Maven

Next, you will need to create an environment variable file and define the path of the Maven.

nano /etc/profile.d/

Add the following lines.

export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

Save and close the file, then activate the environment variable with the following command.

source /etc/profile.d/

Now, verify the Apache Maven version with the following command.

mvn -version

You should see the Maven version in the following output.

Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /opt/maven
Java version: 11.0.15, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.12.8-300.fc34.x86_64", arch: "amd64", family: "unix"

Step 5 – Create a Project Using Maven

First, create a directory for the Maven project.

mkdir project

Next, navigate to the project directory and create a project using the following command.

cd project
mvn archetype:generate \
-DartifactId=test-app \
-DarchetypeArtifactId=maven-archetype-quickstart \

You should see the following output.

[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: /root/project
[INFO] Parameter: package, Value:
[INFO] Parameter: groupId, Value:
[INFO] Parameter: artifactId, Value: test-app
[INFO] Parameter: packageName, Value:
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: /root/project/test-app
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.381 s
[INFO] Finished at: 2023-04-22T02:53:57-04:00
[INFO] ------------------------------------------------------------------------

Next, navigate to the application directory and build a package for your project using the following command.

cd test-app
mvn package

You should see the following output.

[INFO] Building jar: /root/project/test-app/target/test-app-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.213 s
[INFO] Finished at: 2023-04-22T02:55:21-04:00
[INFO] ------------------------------------------------------------------------


In this post, we explained how to install Apache Maven on Fedora. You can now use Apache Maven with other programming languages and manage your project from the central location. In addition, you can now use Apache Maven on dedicated server hosting from Atlantic.Net!


Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year