1. Install the wget command
If you need to download the maven installation package directly through the network by using the wget command, you need to install the wget command in the Linux system.
yum -y install wget
2. Download the maven installation package
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
3. Unzip maven
tar -zxvf apache-maven-3.5.2-bin.tar.gz
The path I decompress maven here is: /var/local
4. Configure maven environment variables
vi /etc/profile
add environment variable
export MAVEN_HOME=/var/local/apache-maven-3.5.2
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
After editing, remember to use the source /etc/profile command to make the changes take effect.
5. Verification results
Execute mvn -version in any path to verify whether the command is valid.
The normal results are as follows, you can see the current maven and jdk versions.