Linux安装maven
安装之前请确保你已经安装好JDK。
1拷贝maven安装文件到服务器上。到附件下载
2创建maven安装目录
[root@iZ94zsv4mnfZ ~]# mkdir /usr/local/maven
3解压安装文件到安装目录
[root@iZ94zsv4mnfZ ~]# tar -zxvf apache-maven-3.3.3-bin.tar.gz -C /usr/local/maven/
4增加环境变量
[root@iZ94zsv4mnfZ ~]# vim /etc/profile
添加如下
export MAVEN_HOME=/usr/local/maven/apache-maven-3.3.3
export PATH=${MAVEN_HOME}/bin:${PATH}
保存文件并退出(:wq)
更新环境变量文件,使之立即生效
[root@iZ94zsv4mnfZ ~]# source /etc/profile
5检查是否安装成功
[root@iZ94zsv4mnfZ ~]# mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: /usr/local/maven/apache-maven-3.3.3
Java version: 1.8.0_102, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_102/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"
[root@iZ94zsv4mnfZ ~]#