创建安装路径并下载maven包
创建安装路径
mkdir /usr/local/maven
进入目录
cd /usr/local/maven
下载maven包
wget https://mirrors.bfsu.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
安装及配置maven
解压maven包
tar -zxvf apache-maven-3.6.3-bin.tar.gz
修改setting文件,增加阿里镜像
vi /usr/local/maven/apache-maven-3.6.3/conf/settings.xml
添加:
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
配置环境变量:
vi /etc/profile
添加:
export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
执行配置生效:
source /etc/profile
运行mvn -version可以看到maven信息说明安装成功