This article will show you how to install apache maven on RHEL 7
Install JDK 11 if you don’t have one
Download latest maven binaries version
# Choose a folder to download eg. opt
cd /opt
# Run download command
sudo wget https://downloads.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
# Extract package
sudo tar xzf apache-maven-3.8.6-bin.tar.gz
# Link maven install path
sudo ln -s apache-maven-3.8.6 maven
# Remove downloaded package
sudo rm apache-maven-3.8.6-bin.tar.gz
Setup environment variables
# Create maven.sh file
sudo vi /etc/profile.d/maven.sh
# Add below content
export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
Reboot your server and verify installation
mvn -version