Installing Apache Maven on Amazon EC2 instance


How to install Apache Maven on Amazon EC2 instance

Simple article to show you how you can install latest version of Apache Maven on an Amazon EC2 instance in few quick and easy steps. Things like directory structure is purely a personal preference.


  • java 1.7 (assumed installed)
  • amazon ec2 instance (assumed available)
  • apache maven

As you log-in to your EC2 instance using ‘ec2-user’, you are now in your home directory.

Get the latest version of Apache Maven from the mirror service

This will download the latest Apache Maven (3.2.1 as of this writing) tar file into your home directory. Untar the file using

This will create a folder apache-maven-3.2.1 in your home directory. You can now move this directory to your desired location. My personal preference is to move it to /usr/local/maven or /usr/share/maven

Another personal preference is to create a version agnostic symlink to the latest version of the maven installation. This allows you to change/upgrade versions without having to change exported paths etc.

Now we add the path of the current maven installation to ec2-user bash profile, so that it is available to us whenever we login

And add the following paths to the ec2-user bash profile

Reload your bash profile using

You can check your maven installation using