环境介绍
操作系统:CentOS Linux release 7.8.2003 (Core)
安装
1、安装wget命令
yum -y install wget
2、下载maven安装包
wget --no-check-certificate https://mirrors.cnnic.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
注意:
通过wget方式下载maven安装包时,出现以下错误时,在wget后面加上--no-check-certificate
ERROR: cannot verify mirrors.cnnic.cn's certificate, issued by ‘/C=GB/ST=Greater Manchester/L=Salford/O=Sectigo Limited/CN=Sectigo RSA Domain Validation Secure Server CA’:
Issued certificate has expired.
To connect to mirrors.cnnic.cn insecurely, use `--no-check-certificate'.
3、解压maven安装包
tar -xvf apache-maven-3.6.3-bin.tar.gz
4、配置maven
vi /etc/profile
export MAVEN_HOME=/usr/local/maven
export PATH=$MAVEN_HOME/bin:$PATH
5、环境变量生效
source /etc/profile
6、检查maven环境是否安装成功
mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00)
Maven home: /opt/maven3.5
Java version: 1.8.0_141, vendor: Oracle Corporation, runtime: /opt/jdk8/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.el7.x86_64", arch: "amd64", family: "unix"