一 环境
1.1 操作系统
[root@host-xxxsoft]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.6 (Final)
Release: 6.6
Codename: Final
[root@host-xxx soft]#
1.2 jdk 版本
jdk 版本1.7
1.3 安装目录
/usr/local
1.4 安装版本3.3.9
二. 安装
2.1 下载 官网下载
链接
http://mirrors.cnnic.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
2.2 解压&安装
[root@host-xxx local]# cd /usr/local/
[root@host-xxx local]# tar -zxvf /root/soft/apache-maven-3.3.9-bin.tar.gz
[root@host-xxx local]# ll
total 48
drwxr-xr-x 6 root root 4096 Sep 27 14:47 apache-maven-3.3.9
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x 8 root root 4096 Apr 11 2015 jdk1.7.0_79
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 5 root root 4096 Apr 27 2015 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
2.3 配置环境变量
vi .bash_profile
添加
MAVEN_HOME=/usr/local/apache-maven-3.3.9
export MAVEN_HOME
PATH="$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:${MAVEN_HOME}/bin:$HOME/bin"
生效
source .bash_profile
三 验证
[root@host-xxx ~]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/local/jdk1.7.0_79/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-504.16.2.el6.x86_64", arch: "amd64", family: "unix"
[root@host-xxx ~]#