cd /opt/soft
#安装maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar -zxvf apache-maven-3.8.6-bin.tar.gz
#设置环境变量
vim /etc/profile
#Set maven
export M2_HOME=/opt/soft/apache-maven-3.8.6
export PATH=${M2_HOME}/bin:$PATH
#使环境变量生效
source /etc/profile
#查看是否安装成功
root@pc:/opt/soft# mvn -version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /opt/soft/apache-maven-3.8.6
Java version: 1.8.0_333, vendor: Oracle Corporation, runtime: /opt/soft/jdk1.8.0_333/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-167-generic", arch: "amd64", family: "unix"