sAmI
sAmIhttps://losersgaming.com
I'm a freelancer and a semi-professional VALORANT Player from Pakistan, Expert in Network & System Administration & WordPress Developing.

How to install Apache Maven on Ubuntu/Debian Servers

- Advertisement -

This post is about how to install Apache Maven on Ubuntu / Debian

Apache Maven is a free and open-source project management tool used for Java Projects and also automate the development procedure of such projects. It can be used for C#,Ruby and other proramming Languages. It uses a Project Object Model, Which essentially contains information about the configuration details, Projects Dependencies, Project Details and more in a XML File.

Requirements :

  • 512MB or more RAM (In this case there is no as such of a minimum requirement)
  • 1vCore or more CPU
  • 500MB or more Disk Space (It all comes too your project sizes can vary in your case)
  • OpenJDK Installed on your machine

Step 1 : Update your server

First step is to update your server and look for any newer packages and security releases may available for your server

apt-get update -y
apt-get upgrade -y

Step 2 : Install Apache Maven (Automatic Way)

Maven can be installed on both Ubuntu and Debian through apt easily it takes only a single command to be installed

apt-get update
apt-get install maven

Verify the installing by running the following command :

mvn -version

Step 2 (B) : Installing Maven (Manual Way)

Maven can be installed manually, This is for more advanced linux users, as it allows users to any specific version they wish to or fix any issues related.

Maven required OpenJDK 1.7 or greater run the following command to install OpenJDK 11

apt install default-jdk

Verify the installation by running the following command :

java -version

Download the Maven files from the official mirror link, You can search the latest version here

cd /tmp
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz

Extract the downloaded file :

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

Copy the extracted folder to /opt/ folder

cp -r apache-maven-3.8.6 /opt/maven

Next step is to configure environment variables by creating a script in profile.d folder :

nano /etc/profile.d/maven.sh

Paste the following code into the file :

export JAVA_HOME=/usr/lib/jvm/default-java
export M2_HOME=/opt/maven
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

Give executable permissions to the script :

chmod +x /etc/profile.d/maven.sh

Load the environment variables using the source command :

source /etc/profile.d/maven.sh

Verify the installation by running the following command :

mvn -version

Conclusion :

You have installed Apache Maven on your Ubuntu or Debian Machine, This tutorial was tested on Debian 10 and Ubuntu 20.04. This tutorial assumes you are root!

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook

x