For the latest download link check the Apache Maven download page:
https://maven.apache.org/download.cgi
Download Apache Maven
cd~
wget "http://mirror.sdunix.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz"
Create directory and install
sudo mkdir /usr/local/maven
sudo tar xzf apache-maven-3.3.9-bin.tar.gz -C /usr/local/maven
cd /usr/local
sudo ln -s apache-maven-3.3.9 latest
sudo ln -s latest default
cd /usr/local/bin
sudo ln -s /usr/local/maven/latest/bin/mvn mvn
Verify install
mvn -version
Allow all users in the enfironment to use the latest:
sudo sh -c "echo export M2_HOME=/usr/local/maven/latest >> /etc/environment"
the first cd command is wrong, it should be:
cd /usr/local/maven