1 下载文件
https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz
2 上传服务器,并解压
tar -zxvf apache-maven-3.9.6-bin.tar.gz
3 转移目录
sudo mv apache-maven-3.9.6 /usr/local/maven/
4 设置环境变量
export M2_HOME=/usr/local/maven/apache-maven-3.9.6/
PATH=PATH
source /etc/profile
5 验证
echo $M2_HOME
echo $PATH
mvn -v