How To Install Apache Maven on Debian 10 / Debian 9 Mar 12, 2020 Raj 2 min read CONTENTS Install Java Install Apache Maven Setup Environment Variables Verify Apache Maven Installation Conclusion SHARE THIS DOCUMENT IS ALSO AVAILABLE FOR CentOS 8 CentOS 7 Debian 9 Ubuntu 18.04 Ubuntu 16.04 Apache Maven is a free build automation tool based on the Project Object Model. With Maven, you can easily manage a project’s build (used primarily for Java projects), reporting, and documentation from a central piece of information. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. This post will help you to install Apache Maven on Debian 10 & Debian 9. Install Java Apache Maven requires JDK 1.7 or above. Follow the link to install Oracle JDK on your system. READ: How To Install Oracle Java JDK on Debian 10 / Debian 9 OR If you wish to use OpenJDK for Maven, you can just use the apt package manager to install the latest version of the OpenJDK package. sudo apt update sudo apt install -y default-jdk Verify the Java installation. java -version Output: (Debian 10) openjdk version "11.0.6" 2020-01-14 OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1) OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode, sharing) Install Apache Maven You can visit Apache Maven’s official website to download the latest stable version of Maven or use the below command to download the Apache Maven v3.6.3 using the terminal curl -O http://apachemirror.wuchna.com/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz Extract the Maven archive using the tar command. sudo tar -zxvf apache-maven-3.6.3-bin.tar.gz sudo mv apache-maven-3.6.3 /opt/maven Setup Environment Variables After you have moved Apache Maven binaries on your system to /opt, set the environment variables by creating a maven.sh file under /etc/profile.d/ directory. sudo nano /etc/profile.d/maven.sh Add the following content. export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64 export M2_HOME=/opt/maven export PATH=${M2_HOME}/bin:${PATH} Get JAVA_HOME information from the sudo update-java-alternatives -l command Load the above environment variables in the current shell session using the below command. source /etc/profile.d/maven.sh Verify Apache Maven Installation Check whether the Apache Maven has been successfully configured on your system using the below command. mvn -version Output: Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /opt/maven Java version: 11.0.6, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "4.19.0-6-cloud-amd64", arch: "amd64", family: "unix" Conclusion That’s All. I hope you learned how to install Apache Maven on Debian 10 / Debian 9. debian-10 debian-9 maven Prev Post How To Install Pip on CentOS 8 / RHEL 8 Next Post How To Install ImageMagick and PHP Imagick on CentOS 8 / RHEL 8 RELATED POSTS How To Install Node.js on Debian 10 / Debian 9 How To Install MongoDB 4.4 / 4.2 / 4.0 on Debian 10 Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus RECENT POSTS How To Install VirtualBox On Linux Mint 20 How To Backup and Restore Ubuntu & Linux Mint With Timeshift How To Upgrade To Linux Mint 20 From Linux Mint 19 [Detailed Guide] How To Install KVM On Ubuntu 20.04 / Linux Mint 20 How To Install Plex Media Server On Ubuntu 20.04 / Linux Mint 20 How To Install Android Studio on Ubuntu 20.04 TOP POSTS Install xrdp on CentOS 7 / RHEL 7 Install Gnome GUI on CentOS 7 / RHEL 7 Change default network name (ens33) to old “eth0” on Ubuntu… Install μTorrent (uTorrent) on Ubuntu 14.04 How To Configure High-Availability Cluster on CentOS 7 /… How To Install and Configure VNC Server in CentOS 7 / RHEL 7