-->

Thursday, June 2, 2016

Apache Maven Installation on Centos Linux

Apache Maven is widely being used follow the following steps to install the Apache Maven on your system

 cd /opt  
 wget http://redrockdigimark.com/apachemirror/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
  unzip apache-maven-3.3.9-bin.zip

This will create a directory as apache-maven-3.3.9 and completes the apache maven installation



Next you need to setup the Environment variables for the apache maven

 vi /etc/rc.d/rc.local  
 
  export M2_HOME=/opt/apache-maven-3.3.9
 export M2=$M2_HOME/bin
 export PATH=$M2:$PATH

Save and exit the file and source the file as

 source /etc/rc.d/rc.local  

This would affect the environment of you user only. If you want to make it available for all the users add the same in the /etc/profiles instead of /etc/rc.d/rc.local

This completes the installation of the maven and you can test it as

 mvn -version  

It should give an output as follows

[root@ip-172-31-18-166 ~]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_92/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-642.el6.x86_64", arch: "amd64", family: "unix"


0 comments:

Post a Comment