一 下载maven bin包并解压
$ wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz $ tar - zxvf apache-maven-3.3.9-bin.tar.gz $ sudo mv apache-maven-3.3.9 /usr/local/
二 配置maven环境变量
将如下内容添加到/etc/profile中
export M2_HOME=/usr/local/apache-maven-3.3.9 export PATH=$PATH:$M2_HOME/bin
执行source /etc/profile使环境变量生效
三 检查是否安装成功
hadoop@ubuntu:/soft/maven/apache-maven-3.3.9$ mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00) Maven home: /soft/maven/apache-maven-3.3.9 Java version: 1.8.0_112, vendor: Oracle Corporation Java home: /soft/jdk1.8.0_112/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-47-generic", arch: "i386", family: "unix" hadoop@ubuntu:/soft/maven/apache-maven-3.3.9$