- Download the latest version from Maven's website:
curl -O https://dlcdn.apache.org/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz- Extract it:
tar xzvf apache-maven-3.8.5-bin.tar.gz- Move the Maven directory to
/opt:
sudo mv apache-maven-3.8.5 /opt/ - Add the
bindirectory inside the Maven directory to thePATHenvironment variable:
export PATH="/opt/apache-maven-3.8.5/bin:$PATH"- Confirm that installation was successful
mvn -v