下载maven
下载开源的东西当然是去官网咯
http://maven.apache.org/download.cgi
安装
先上官方安装guide
http://maven.apache.org/install.html
JDK
确保JAVA_HOM
已经设置在环境变量中好
解压压缩包
unzip apache-maven-3.3.9-bin.zip
或
tar xzvf apache-maven-3.3.9-bin.tar.gz
添加bin到PATH
编辑全局环境变量
#vim /etc/profile
添加
export MAVEN_HOME=/opt/apache-maven-3.3.9
export PATH=$PATH:$MAVEN_HOME/bin
验证
source /etc/profile
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_65/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: “linux”, version: “4.2.0-42-generic”, arch: “amd64”, family: “unix”
总结
其实*nix 下二进制安装,基本是三步骤
- 下载二进制包(源码安装左拐 -_-||)
- 添加
bin
到环境变量 - 生效环境变量,验证