Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Tutorials»How to Install Apache Maven on Fedora 35/34

    How to Install Apache Maven on Fedora 35/34

    RahulBy RahulOctober 7, 20192 Mins ReadUpdated:April 18, 2022

    Apache Maven is a software project management anud comprehension tool. Maven can manage a project’s build, kreporting, and kdkocumentation from a central piece of information.

    This tutorial will help you to install Apache Maven on Fedora Linux systems.

    Prerequisites

    Java Development Kit (JDK) is the primary requirement for Apache Maven. So you need to install Java on your system. Make sure you have installed JDK, not JRE.

    java -version 
    
    Output:
    openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment 18.9 (build 11.0.11+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing)

    If you don’t have Java Development Kit installed on your system. Visit Install Java on Fedora

    Step 1 – Install Maven on Fedora

    After verifying java version on your system. Download the latest Apache Maven from its official download page or use the following command to download Apache Maven.

    wget https://www-us.apache.org/dist/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz 
    

    Now extract downloaded archive using following command.

    sudo tar xzf apache-maven-3.8.5-bin.tar.gz -C /opt 
    cd /opt && sudo ln -s apache-maven-3.8.5 maven 
    

    Step 2 – Set Environment Variables

    As you have downloaded precompiled Apache Maven files on your system. Now set the environments variables by creating new file /etc/profile.d/maven.sh.

    sudo vi /etc/profile.d/maven.sh 
    

    Add the following content.

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

    Save file content and close it.

    Now load the environment variables in the current shell using the following command.

    source /etc/profile.d/maven.sh 
    

    Step 3 – Check Maven Version

    Apache Maven has been successfully configured on your system. Use the following command to check the version of installed Maven on your system.

    mvn -version 
    
    Output:
    Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0 Maven home: /opt/maven Java version: 11.0.11, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-2.fc33.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.8.15-301.fc33.x86_64", arch: "amd64", family: "unix"

    Finally, remove the downloaded archive file from the system to free disk space.

    rm -f apache-maven-3.8.5-bin.tar.gz 
    

    How to Uninstall Maven on Ubuntu

    You can simply remove the extracted Maven directory from your system. As the above instructions installed the Maven under /opt directory.

    Use the following commands to remove Maven from your system.

    sudo unlink /opt/maven 
    sudo rm -rf /opt/apache-maven-3.8.5  ## Run this command carefully 
    rm -f /etc/profile.d/maven.sh 
    

    Conclusion

    In this tutorial, you have learned about installing Apache Maven on the Fedora Linux system.

    Apache Maven mvn
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Java 11/8 on Fedora
    Next Article How to Increase Open Files Limit in Ubuntu & Debian

    Related Posts

    (Resolved) userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms

    Updated:May 10, 20221 Min Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How To Enable SSH Server on Ubuntu 22.04

    Updated:April 22, 20222 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    How To Disable HTTP Methods in Apache

    Updated:December 31, 20212 Mins Read

    10 Best Linux Video Players in 2022

    Updated:February 18, 20226 Mins Read

    3 Comments

    1. rob on August 2, 2020 2:23 pm

      why not just use sudo dnf install maven?

      Reply
      • Vasya on January 8, 2021 6:31 pm

        coz sometimes version from repo didn’t work as defined

        Reply
    2. m on February 13, 2020 10:57 am

      Hi, thank you for the very descriptive and helpful tutorial. I have a couple of questions:

      Does the final step in Task 3 means that I have to run the command every time I open a new terminal?

      I wan to use maven to build a java project so do I have to run this command every time I build the project again after changes?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.