install maven on linux code example

Example 1: install maven in ubuntu

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install maven

Example 2: how to install maven

Download from https://maven.apache.org/download.cgi
Extract the zip/tar to desired location 
Ensure JAVA_HOME variable is correctly configured to a JDK
For Windows-
Go to MyComputer -> properties -> Advanced System Settings -> Environment variables -> click new button
Add 'MAVEN_HOME' to the directory where Maven is extracted. Eg- "C:\apache-maven-3.8.1"
Edit the path variable and add MAVEN_HOME\bin to it. Use this as it is- "%MAVEN_HOME%\bin" (without quotes)
Save the changes
Check the installation by running the command "mvn -version" in CMD.