Tuesday, February 23, 2016

Install Maven in Cent OS

First of all you need to download the latest version of maven. For this requirement you can follow this link. 

http://mirrors.gigenet.com/apache/maven/maven-3/

Select the appropriate version that you want to use. Please make sure you download it to your local home directory to avoid unnecessary permission issues.  

tar -zxvf apache-maven-3.2.3-bin.tar.gz 
cd <location that you extract the zip file>
sudo ln -s apache-maven-3.2.3 maven

The next step is to setup the Maven environment variables in a shared profile so all users on the system will get them import at login time.

su -c "vi /etc/profile.d/maven.sh"

# Add the following lines to maven.sh
export M2_HOME=/usr/local/maven
export M2=$M2_HOME/bin
PATH=$M2:$PATH

you also need to edit your .bashrc file and add environmental variables. Then issue 

source .bashrc 

command to get effected the changes.

Then issue following command to check whether you have install the maven correctly.

mvn -version

No comments:

Post a Comment