1. Download the maven package from the official website
Official download site:/
2. Create a folder to unzip the file
Take the downloaded installation package, put it in the created directory, and unzip it.
a. Create /app/maven file
mkdir /app/maven
b. Unzip the file
tar -zxvf apache-maven-3.9.
c. Configuration files
- a) maven repository address
<localRepository>/app/maven/repo</localRepository>
- b) maven image
<mirror> <id>aliyunmaven</id> <mirrorOf>central</mirrorOf> <name>AliCloud Public Warehouse</name> <url>/repository/public</url> </mirror>
3. Configure /etc/profile
- Open file
vim /etc/profile
- Putting the configuration inside
# maven export MAVEN_HOME=/app/maven/apache-maven-3.9.6 export PATH=$PATH:$MAVEN_HOME/bin
- Reload the file
source /etc/profile
- beta (software)
mvn -version
[root@test apache-maven-3.9.6]# mvn -version Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /app/maven/apache-maven-3.9.6 Java version: 1.8.0_401, vendor: Oracle Corporation, runtime: /app/java/jdk1.8.0_401/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1127.19.1.el7.x86_64", arch: "amd64", family: "unix"
summarize
The above is a personal experience, I hope it can give you a reference, and I hope you can support me more.