下载
代码语言:txt复制[root@localhost ~]# wget https://ali.kenvie.com/Downloads/apache-maven-3.8.2-bin.tar.gz
[root@localhost ~]# ls
apache-maven-3.8.2-bin.tar.gz
安装
创建安装目录:
代码语言:txt复制[root@localhost ~]# mkdir /usr/local/maven/
解压到安装目录:
代码语言:txt复制[root@localhost ~]# tar -zxvf apache-maven-3.8.2-bin.tar.gz -C /usr/local/maven/
设置环境变量
配置profile文件
代码语言:txt复制vim /etc/profile
在末尾添加下面两行:
代码语言:txt复制MAVEN_HOME=/usr/local/maven/apache-maven-3.8.2
export PATH=${MAVEN_HOME}/bin:${PATH}
使环境变量生效:
代码语言:txt复制source /etc/profile
检查安装:
代码语言:txt复制[root@localhost ~]# mvn -v
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /usr/local/maven/apache-maven-3.8.2
Java version: 1.8.0_301, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8.0_301/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-1062.el7.x86_64", arch: "amd64", family: "unix"