Install maven and configure environment variables under linux

This article introduces the installation and configuration of maven, let's start!
1. Create a maven directory to find it later

mkdir /usr/local/maven
cd /usr/local/maven

2. Download maven3.8.5, it may be a bit slow, you can also download it in window, and then import it with rz

wget https://archive.apache.org/dist/maven/maven-3/3.8.5/binaries/apache-maven-3.8.5-bin.tar.gz

unzip it

tar -zxvf apache-maven-3.8.5-bin.tar.gz

3. Configure environment variables and modify the profile file with caution. Copy the whole paragraph, then press esc, shift+zz to save

vim /etc/profile

export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.5
export PATH=${PATH}:${MAVEN_HOME}/bin

Make the profile configuration take effect

source /etc/profile

4. You're done, check it out

mvn -version

insert image description here

successfully installed

Guess you like

Origin blog.csdn.net/weixin_43793525/article/details/124074574