Skip to content

Instantly share code, notes, and snippets.

@skanjo
Last active March 8, 2018 16:27
Show Gist options
  • Save skanjo/b99ddcab140113487d7d to your computer and use it in GitHub Desktop.
Save skanjo/b99ddcab140113487d7d 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

cd~
wget "http://mirror.sdunix.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-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"
@frafornari
Copy link

frafornari commented Mar 8, 2018

the first cd command is wrong, it should be:

cd /usr/local/maven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment