两种方式
1. yum安装
wget http://download.hkyh.net:28066/maven/epel-apache-maven.repo
yum -y install apache-maven
2. 源码安装
cd /usr/local/
下载 https://share.weiyun.com/lWYvWb3R
unzip apache-maven-3.5.3.zip
ln -s /usr/local/apache-maven-3.5.3/bin/mvn /usr/local/bin/
vim /etc/profile #追加
export MAVEN_HOME=/apache-maven-3.5.3
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile
版本查询
mvn -v
mvn 打包服务器本地仓库配置
<server>
<id>huan</id>
<username>root</username>
<password>123</password>
</server>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>huan</id>
<name>huan</name>
<url>http://manshushahua.com:26666/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>huan</id>
<name>huan</name>
<url>http://manshushahua.com:26666/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
来源:oschina
链接:https://my.oschina.net/huanke/blog/4304196