How to install maven on Ubuntu manually with any specific version

For installing Maven on Ubuntu you have two ways  the easy way and the manual method. The easy way is just execute following command :

sudo apt-get install maven

Or if you use Ubuntu 16+ you can use following command too :

sudo apt install maven

Just remember you need to have root privileges.

The manual way

If you want to have the latest version of Maven on your Ubuntu go to the Maven website and download the latest binary package then you can extract it in /opt/  using command :

tar xvf apache-maven-3.5.2-bin.tar.gz -C /opt/

make sure you have set your JAVA_HOME if you don’t know how you can read this post

then open up your /etc/environment add following to your path

PATH=_YOUR_OLD_PATH:/opt/apache-maven-3.5.2/bin/

quit from your editor then type

source /etc/environment

to test if maven is installed type

mvn -v

 

Leave a Reply

Your email address will not be published. Required fields are marked *