Maven
Please make sure the environment is installed before installing JDK
.
The following installation methods are for reference only, not mandatory, and can be installed and configured according to actual scenarios:
Maven
It is a public software, so it is installed and configured by root
users .
In order to facilitate the unified management of the software, the installation of the software is in /opt
the directory
1. Enter /opt
the directory ( root
permission is required by default), create maven
a directory , and download Maven
the package.
cd /opt
# 创建 maven 目录
mkdir maven
cd maven
# 获取 Maven 软件包(清华大学源) zip 和 tar.gz 任选一个下载即可
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
# 如果提示 https 证书过期可以使用 --no-check-certificate 参数进行忽略
wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
[Note] For more versions, please visit (Tsinghua University source): https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3
2. Unzip the package
unzip apache-maven-3.6.3-bin.zip
# 如果是下载的 tar.gz 包请使用以下命令
tar xzvf apache-maven-3.6.3-bin.tar.gz
3. Configure the Maven environment
# 打开环境配置文件
sudo vim /etc/profile
# 在末尾添加以下两行,记得使用实际的路径来替换
export MAVEN_HOME=/opt/maven/apache-maven-3.6.3
export PATH=${
PATH}:${MAVEN_HOME}/bin
#点击 ESC ,并输入 wq 进行保存
4. Validate the environment
source /etc/profile
5. Check whether Maven is installed successfully
mvn -v
# 成功会输出一下信息
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/maven/apache-maven-3.6.3
Java version: 1.8.0_241, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_241/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-147.5.1.el8_1.x86_64", arch: "amd64", family: "unix"
Personal blog: Roc's Blog