Problem scenario
You want to install Maven with a script. You want the script to work regardless of what distribution of Linux you are using (e.g., Ubuntu/Debian, RedHat (including CentOS/Fedora), or SUSE). How do you write a script to install the latest version of Maven?
Solution
Update: This script was updated on 9/23/19.
1. Create this file in /tmp/ and call it maven.sh. Below is the content:
#!/bin/bash
# Written by www.continualintegration.com
mvnversion=3.6.2 # Change this version as necessary
distro=$(cat /etc/*-release | grep NAME)
debflag=$(echo $distro | grep -i “ubuntu”)
if [ -z “$debflag” ]
then # If it is not Ubuntu, …
Continue reading “How Do You Install Maven on Any Type of Linux?”