一、下载 Maven
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
yum -y install wget 可以安装 wget
解压:tar -zxvf apache-maven-3.3.9-bin.tar.gz -C ../app/
改名:mv apache-maven-3.3.9/ maven-3.3.9
修改权限
chown -R hadoop:hadoop maven-3.3.9/
二、配置 maven
vi /etc/profile
source /etc/profile
#maven
export MAVEN_HOME=/opt/app/maven-3.3.9
export PATH=$PATH:$MAVEN_HOME/bin
三、测试
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/app/maven-3.3.9
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: /opt/app/jdk1.8.0/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-642.el6.x86_64", arch: "amd64", family..
四、配置 maven 仓库为阿里云
vi setting.xml
<!--阿里云镜像仓库 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
配置到本地仓库
<localRepository>/home/maven/repo</localRepository>
安装成功。
原文地址:https://www.cnblogs.com/Orange1996/p/11116163.html