首先搭建java环境,然后
wget http://apache.mirror.anlx.net/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
tar zxvf apache-maven-3.1.1-bin.tar.gz
root@AR:~# cd apache-maven-3.1.1
root@AR:~/apache-maven-3.1.1# ls
bin boot conf lib LICENSE NOTICE README.txt
root@AR:~/apache-maven-3.1.1# cd bin
root@AR:~/apache-maven-3.1.1/bin# ls
m2.conf mvn mvn.bat mvnDebug mvnDebug.bat mvnyjp
root@AR:~/apache-maven-3.1.1/bin#
export PATH=$PATH:
/root/apache-maven-3.1.1/bin/
(设置环境变量)
root@AR:~/apache-maven-3.1.1/bin# nano /etc/profile
(把
export PATH=$PATH:
/root/apache-maven-3.1.1/bin/添加到
/etc/profile文件的末尾。)
root@AR:~/apache-maven-3.1.1/bin# cd ~
root@AR:~# mvn -version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Maven home: /root/apache-maven-3.1.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /root/jdk1.8.0_05/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-042stab103.6", arch: "i386", family: "unix"
root@AR:~#
(运行
mvn -version
命令检验是否正确地安装了 Maven。如上的显示则表明正确地安装了 Maven。)