Skip to content

Instantly share code, notes, and snippets.

@TheBeachMaster
Forked from skanjo/install-maven-centos.md
Last active February 9, 2018 09:20
Show Gist options
  • Save TheBeachMaster/5cc9e00b1b2408503a6b32e8815914c2 to your computer and use it in GitHub Desktop.
Save TheBeachMaster/5cc9e00b1b2408503a6b32e8815914c2 to your computer and use it in GitHub Desktop.
Install Apache Maven on CentOS

For the latest download link check the Apache Maven download page:

https://maven.apache.org/download.cgi

Download Apache Maven

sudo mkdir /opt/src/maven-bin
cd /opt/src/maven-bin && sudo wget "http://www-us.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz"

Create directory and install

sudo mkdir /usr/local/maven
sudo tar xzf apache-maven-3.3.9-bin.tar.gz -C /usr/local/maven
cd /usr/local
sudo ln -s apache-maven-3.3.9 latest
sudo ln -s latest default
cd /usr/local/bin
sudo ln -s /usr/local/maven/latest/bin/mvn mvn

Verify install

mvn -version

Allow all users in the enfironment to use the latest:

sudo sh -c "echo export M2_HOME=/usr/local/maven/latest >> /etc/environment"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment