CentOS7安装Maven3

下载安装文件

cd /opt/software/
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

解压安装

tar -zxf apache-maven-3.3.9-bin.tar.gz -C /opt/module/
cd /opt/module/
mv apache-maven-3.3.9 maven

配置环境变量

vim /etc/profile
# 新增以下内容
export M2_HOME=/opt/module/maven3
export PATH=${M2_HOME}/bin:$PATH

使配置文件生效

source /etc/profile

测试检查maven版本:

[root@node01 flink-1.9.1-bin]# mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/module/maven3
Java version: 1.8.0_231, vendor: Oracle Corporation
Java home: /opt/module/jdk1.8.0_231/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"

你可能感兴趣的:(环境搭建,Maven)