标签:
首先已经安装完JDK
1.下载apache-maven-3.2.3-bin.tar.gz
2.复制到/opt 解压
[root@iZ2873rjubzZ opt]# cp apache-maven-3.2.3-bin.tar.gz /opt/ [root@iZ2873rjubzZ opt]# tar -xzvf apache-maven-3.2.3-bin.tar.gz
3. 设置环境变量
[root@iZ2873rjubzZ opt]# vi /etc/profile ##shift+g定位到文件末尾,添加以下代码 export M2_HOME=/opt/apache-maven-3.2.3
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$M2_HOME/bin
##执行以下命令让配置文件生效
[root@iZ2873rjubzZ opt]# source /etc/profile
##执行以下命令验证是否安装成功
[root@iZ2873rjubzZ opt]# mvn -version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T04:58:1 0+08:00)
Maven home: /opt/apache-maven-3.2.3
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /opt/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "amd64", family:"unix"
标签:
原文地址:http://www.cnblogs.com/yyh19890221/p/4184866.html