Installing maven in CentOS 7
Get the maven binary distribution from maven official site
wget http://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.tar.gz
Extract the download file
tar xzf apache-maven-3.2.3-bin.tar.gz
Move the extacted folder to the installation folder (requires superuser su):
mkdir -p /opt/apache-maven
mv apache-maven-3.2.3 /opt/apache-maven
Create a symbolic link that will allow to update maven easily in the future.
ln -s /opt/apache-maven/apache-maven-3.2.3 /opt/apache-maven/default
Create environment variables adding the following content to the file /etc/profile.d/maven.sh
this will set the enviroment variables for all the users everytime the server starts.
export M2_HOME=/opt/apache-maven/default
export M2=$M2_HOME/bin
export PATH=$M2:$PATH