Last active
March 5, 2018 09:27
-
-
Save M3lkior/a24e7ec1a5dbe75cdcb20079599933f2 to your computer and use it in GitHub Desktop.
Maven Installation (on CentOs 7)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The first thing we need to do is to download the Maven tar file and untar it to a shared location on the workstation | |
# wget required (yum install wget) | |
# STEP 1 - Get Maven Install | |
export JAVA_HOME='/etc/alternatives/jre_1.8.0' | |
export MAVEN_VERSION='3.5.2' | |
export MAVEN_MIRROR='http://apache.mindstudios.com' | |
wget $MAVEN_MIRROR/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz -P /tmp | |
su -c 'tar -zxvf /tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C /opt' | |
# STEP 2 - Create a maven.sh | |
# Setup the Maven Environment Variables in shared profile. | |
# 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. | |
echo "export M2_HOME=/opt/apache-maven-$MAVEN_VERSION" >> "/etc/profile.d/maven.sh" | |
echo "export JAVA_HOME=$JAVA_HOME" >> "/etc/profile.d/maven.sh" | |
echo 'export M2=$M2_HOME/bin' >> "/etc/profile.d/maven.sh" | |
echo 'PATH=$M2:$PATH' >> "/etc/profile.d/maven.sh" | |
# check content with : su -c "vi /etc/profile.d/maven.sh" | |
# Now test your install of Maven. | |
# Reload profile with . /etc/profile or Logout of the system and then log back into it. Enter the following command: mvn -version | |
# you are done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment