Skip to content

Instantly share code, notes, and snippets.

@satishchennu1
Created March 2, 2020 21:28
Show Gist options
  • Select an option

  • Save satishchennu1/694987b58b4e0a73e5c9695ca53ea571 to your computer and use it in GitHub Desktop.

Select an option

Save satishchennu1/694987b58b4e0a73e5c9695ca53ea571 to your computer and use it in GitHub Desktop.
Install and configure maven
Move to home folder and create a new folder for maven artifacts:
cd ~ && mkdir installed-packages
Go to https://maven.apache.org/download.cgi and wget the latest artifact:
If you don't have wget installed: sudo yum install -y wget
cd ~/installed-packages
wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
Uncompress the downloaded file:
tar -xvf apache-maven-3.6.3-bin.tar.gz
Create a symbolic link of the uncompressed file:
ln -s ~/installed-packages/apache-maven-3.6.3 /usr/local/apache-maven
Edit ~/.bash_profile (This is where environment variables are commonly stored):
vi ~/.bash_profile
Add the variable: MVN_HOME=/usr/local/apache-maven (do this before PATH variable is defined)
(For those who don't know vi tool: Press i key to enable insert mode)
Go to the end of the line where PATH variable is defined and append the following: :$MVN_HOME:$MVN_HOME/bin
Save changes
(For those who don't know vi tool: Press esc key to exit insert mode and :wq! to save and quit file)
Reload environment variables:
source ~/.bash_profile
Confirm that maven command now works properly:
mvn --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment