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 Distributions»Debian»How to Install Apache Maven on Debian 11/10

    How to Install Apache Maven on Debian 11/10

    RahulBy RahulMarch 18, 20182 Mins ReadUpdated:May 26, 2022

    Apache Maven is a software project management and comprehension tool. Maven can manage a project’s build, reporting, and documentation from a central piece of information. This tutorial will help you to install Apache Maven on Debian 11, Debian 10, Debian 9, and Debian 8 systems.

    You may like:

    • How to Install Gradle on Debian 10

    Prerequisites

    Login to your Debian system using shell access. For the remote systems connect over SSH connection.

    ssh [email protected]
    

    Run the below commands to upgrade the current packages to the latest version.

    sudo apt update 
    sudo apt upgrade
    

    Step 1 – Install Java

    Apache Maven required Java to be installed on your system. I have installed latest Java 11 on my Debian system using this tutorial.

    java -version 
    
    java version "11.0.2" 2019-01-15 LTS
    Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
    

    Step 2 – Installing Maven on Debian

    After installation of Java. You are read to install Apache Maven on Debian. Download the Apache maven archive file from its official website or use following command to download Apache Maven 3.6.3.

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

    Extract downloaded archive using following command.

    sudo tar xzf apache-maven-3.8.5-bin.tar.gz
    sudo ln -s apache-maven-3.8.5 apache-maven
    

    Step 3 – Configure Maven Environment

    You need to set the M2_HOME and MAVEN_HOME environment variables to work with Maven on Debian. Also, set the bin directory to the PATH environment variable. You can set the environments variables by creating new file /etc/profile.d/apache-maven.sh.

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

    and add following content.

    export JAVA_HOME=/usr/lib/jvm/java-11-oracle
    export M2_HOME=/usr/local/apache-maven
    export MAVEN_HOME=/usr/local/apache-maven
    export PATH=${M2_HOME}/bin:${PATH}
    

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

    source /etc/profile.d/apache-maven.sh
    

    Step 4 – Verify Installation

    You have successfully installed and configured Apache Maven on your Ubuntu system. Use the following command to check the version of Maven.

    mvn -version
    
    Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
    Maven home: /usr/local/apache-maven
    Java version: 11.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-oracle
    Default locale: en, platform encoding: UTF-8
    OS name: "linux", version: "4.15.0-46-generic", arch: "amd64", family: "unix"
    

    The Installation of Apache Maven on the Debian system has been completed successfully. You can now remove the downloaded archive file from your system to free space.

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

    To read more about Apache Maven visit here.

    Apache Maven install maven install maven on linux Maven
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Compile and Install Redis Latest Version on a Linux VPS
    Next Article How to Install Redis on Ubuntu 18.04 & 16.04 LTS

    Related Posts

    How to Install Apache Maven on Ubuntu 22.04

    Updated:June 2, 20223 Mins Read

    How to Create a Sudo User in Debian

    Updated:June 26, 20212 Mins Read

    How To Install XRDP (Remote Desktop) on Debian 10

    4 Mins Read

    Initial Server Setup with Debian 10/9/8

    Updated:June 25, 20214 Mins Read

    How To Install and Configure VNC Server on Debian 10

    Updated:June 26, 20215 Mins Read

    How to Install TeamViewer on Debian 10

    3 Mins Read

    2 Comments

    1. Ray on June 18, 2019 8:43 am

      Thank you

      Reply
    2. Vitor on April 5, 2019 4:43 pm

      Thank you! It worked here.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    • How to Install Composer on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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