Sunday, February 23, 2014

Install Maven on CentOS 6.5

  1. Download maven from Apache website (http://maven.apache.org/download.cgi)
  2. Extract the downloaded file, put the extracted file to /usr/bin

    tar ­xzvf apache­-maven-­[version]­-bin.tar.gz ­C /usr/bin

  3. Then go to the /usr/bin directory and create symlink (symbolic link) for maven.

    cd /usr/bin
    ln ­-s apache-­maven­-[version] maven
    

  4. Then, do the following:

    vi /etc/profile.d/maven.sh

    Put below code into the vi editor and save it:

    export M2_HOME=/usr/local/maven
    export PATH=${M2_HOME}/bin:${PATH}

  5. Then log-out and log-in again to activate the above environment setting.
  6. To check maven is running ok on your computer, type the following using terminal:

    mvn -version