How to Install Apache Maven on Fedora Server Latest

Apache Maven is a powerful project management tool used primarily for Java projects. In this tutorial, we'll guide you through the steps to install Apache Maven on Fedora Server Latest.

Prerequisites

Before you begin, ensure you have the following:

Steps

Follow the below steps to install Apache Maven on your Fedora Server Latest:

1. Update the System

Before installing any package, it's good practice to update the system package cache and update all installed packages to their latest versions. To do so, run the following command on your terminal:

sudo dnf update

This command will download the latest version of packages from the Fedora repository and install them on your system.

2. Install Java

Apache Maven requires Java Development Kit (JDK) version 1.7 or higher to run. If you haven't already installed it, install it using the following command:

sudo dnf install java-devel

Verify the installation by running the following command:

java -version

This command will display the version of Java installed on your system.

3. Download and Extract Apache Maven

To download and extract the latest version of Apache Maven, perform the below steps:

  1. Navigate to the Apache Maven download page at https://maven.apache.org/download.cgi.
  2. Click on a preferred binary zip archive that matches your system.

For instance, downloading apache-maven-3.8.2-bin.zip:

wget https://apachemirror.wuchna.com/maven/maven-3/3.8.2/binaries/apache-maven-3.8.2-bin.zip
  1. After downloading, extract the archived file using the following command:
sudo unzip apache-maven-3.8.2-bin.zip -d /opt/

This command will extract the files from the downloaded archive and place them in the /opt/apache-maven-3.8.2 directory.

4. Set Maven Home Environment Variable

To set up the environment variable M2_HOME, which tells the system where Apache Maven is installed, run the following command to open up the bashrc file:

sudo nano ~/.bashrc

Then, add the following line to the end of the file:

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

Save and exit the file by pressing CTRL+X, then Y, then ENTER.

Run the source command to reload the bashrc file:

source ~/.bashrc

5. Verify the Installation

To verify your installation, run the following command:

mvn -version

This command should display the installed version of Apache Maven.

Apache Maven 3.8.2 (bd32dceec8a8ffaf8975febd0027dd0841b7833f)
Maven home: /opt/apache-maven-3.8.2
Java version: 11.0.12, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.14.12-200.fc34.x86_64", arch: "amd64", family: "unix"

Conclusion

In this article, we have shown you how to install Apache Maven on Fedora Server Latest. Maven is a powerful tool that simplifies project management and helps automate builds. With Maven, Java developers can easily manage their projects, and create executable software in a breeze.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!