1. 下载安装包
[root@les opt]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
2. 解压
[root@les opt]# tar -xf apache-maven-3.6.3-bin.tar.gz -C /usr/local/
[root@les opt]# cd /usr/local/
[root@les local]# mv /usr/local/apache-maven-3.6.3/ maven-3.6.3
3. 添加环境变量
[root@les local]# vi /etc/profile
[root@les local]# source /etc/profile
添加"export PATH=$PATH:/usr/local/maven-3.6.3/bin"
4. 检查安装效果
[root@les local]# which mvn
/usr/local/maven-3.6.3/bin/mvn
[root@les local]# mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/maven-3.6.3
Java version: 1.8.0_292, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.aarch64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-80.7.2.el7.aarch64", arch: "aarch64", family: "unix"
5. 添加镜像
[root@les DataX]# vim /usr/local/maven-3.6.3/conf/settings.xml
镜像内容如下:
<mirrors>
<mirror>
<id>huaweicloud</id>
<mirrorOf>central</mirrorOf>
<name>huaweicloud maven</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>https://repo.spring.io/plugins-release/</url>
</mirror>
</mirrors>