This article will guide you on how to install apache Maven on Ubuntu. Same instructions could be followed for other Linux distributions as well.
Get latest version of Maven binary from below official site.
Extract and copy maven to local directory
mv apache-maven-3.5.2 /usr/local/
Set Maven command in environment variable.
Update ~/.bashrc – create this file if doesn’t exist.
Add below lines at the end
Reload environment variables,
Check if mvn command works.
If everything is good, you should see output like below,
Maven home: /usr/local/apache-maven-3.5.2
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_144/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.8.0-36-generic", arch: "amd64", family: "unix"
Maven is installed now.