install maven on linux
1. Download the installation package from Maven official website
Maven official website address
I downloaded version 3.8
I installed maven operating system CentOS 7.7 64 bits
I upload the downloaded maven installation package to the server through Xftp 7
First create two directories in /usr/local/
[root@localhost local]# mkdir maven
[root@localhost maven]# mkdir repository
I uploaded the maven installation package to the /usr/local/maven directory of the service
[root@localhost /]# cd /usr/local/maven
Unzip apache-maven-3.8.8-bin.tar.gz
[root@localhost maven]# tar -zxvf apache-maven-3.8.8-bin.tar.gz
[root@localhost maven]# ls
apache-maven-3.8.8 apache-maven-3.8.8-bin.tar.gz repository
Two, configure maven
Modify settings.xml
[root@localhost maven]# vim /usr/local/maven/apache-maven-3.8.8/conf/settings.xml
1. Change the mirror address
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
2. Use a custom warehouse
<localRepository>/usr/local/maven/repository</localRepository>
Press the Esc key to exit the editing mode, enter: wq to save and exit the vim editor
3. Configure maven environment variables
edit profile file
[root@localhost maven]# vim /etc/profile
Add the following environment variables at the end of the profile file
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.8
export PATH=$PATH:$MAVEN_HOME/bin
Press the Esc key to exit the editing mode, enter: wq to save and exit the vim editor
refresh source
root@localhost maven]# source /etc/profile
Check if the installation is successful
[root@localhost maven]# mvn -v
success