Installing Maven on Ubuntu

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
Apache Maven is an open-source project management tool primarily used to develop Java applications. It incorporates a POM (Project Object Model) approach, which stores information about projects, configurations, and dependencies in an XML file.
Step 1: Install OpenJDK
Update the system's package repository
sudo apt update
Install the latest OpenJDK version
sudo apt install default-jdk -y
Verify the installation by checking the current OpenJDK version:
java -version
Step 2: Download and Install Maven
Download the Maven installation file to the /tmp directory using the wget cmd
wget https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz -P /tmp
Once the download is complete, extract the installation file to the /opt directory:
sudo tar xf /tmp/apache-maven-3.9.8-bin.tar.gz -C /opt
Create a symbolic link leading to the Maven installation directory:
sudo ln -s /opt/apache-maven-3.9.8 /opt/maven
Step 3: Set Up Environment Variables
Create and open the maven.sh script file in the /etc/profile.d/ directory:
sudo nano /etc/profile.d/maven.sh
Add the following lines to the maven.sh 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}
Use the chmod command to make the maven.sh file executable:
sudo chmod +x /etc/profile.d/maven.sh
Execute the maven.sh script file with the source command to set up the new environment variables:
source /etc/profile.d/maven.sh
Step 4: Verify Maven Installation
mvn -version