File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545> DOCS: 安装配置文档,说明安装的方法以及一些注意事项。
4646
4747* JDK 安装和配置:| [ CODES] ( codes/deploy/tool/jdk ) | [ DOCS] ( docs/deploy/tool/jdk/install-jdk.md ) |
48+ * Maven 安装和配置:| [ CODES] ( codes/deploy/tool/maven ) | [ DOCS] ( docs/deploy/tool/maven/install-maven.md ) |
4849
Original file line number Diff line number Diff line change 1+ # 安装 Maven
2+
3+ 使用方法:
4+
5+ ``` sh
6+ wget --no-check-certificate --no-cookies https://raw.githubusercontent.com/dunwu/linux/master/codes/deploy/tool/maven/install-maven3.sh
7+ chmod -R 777 install-maven3.sh
8+ ./install-maven3.sh
9+ ```
10+
11+ 脚本会下载解压 maven 到 ` /opt/software/maven ` 路径下。
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # ##################################################################################
4+ # 安装 Maven 脚本
5+ # 适用于所有 linux 发行版本。
6+ # Maven 会被安装到 /opt/software/maven 路径。
7+ # 注意:Maven 要求必须先安装 JDK
8+ # Author: Zhang Peng
9+ # ##################################################################################
10+
311echo -e " \n>>>>>>>>> install maven"
412
513mkdir -p /opt/software/maven
@@ -10,9 +18,7 @@ wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-
1018tar -zxvf apache-maven-${version} -bin.tar.gz
1119
1220cat >> /etc/profile << EOF
13- MAVEN_HOME=/opt/software/maven/apache-maven-\$ {version}
14- PATH=\$ {MAVEN_HOME}/bin:\$ {PATH}
15- export MAVEN_HOME
16- export PATH
21+ export MAVEN_HOME=/opt/software/maven/apache-maven-${version}
22+ export PATH=\$ MAVEN_HOME/bin:\$ PATH
1723EOF
1824source /etc/profile
Original file line number Diff line number Diff line change 1+ # Maven 安装
2+
3+ ## 安装方法
4+
5+ 安装步骤如下:
6+
7+ (1)下载
8+
9+ 进入官网下载地址:https://maven.apache.org/download.cgi ,选择合适的版本下载。
10+
11+ 我选择的是最新 Maven3 版本:http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
12+
13+ (2)解压到本地
14+
15+ 我个人喜欢存放在:` /opt/software/maven `
16+
17+ (3)设置环境变量
18+
19+ 输入 ` vi /etc/profile ` ,添加环境变量如下:
20+
21+ ```
22+ # MAVEN 的根路径
23+ export MAVEN_HOME=/opt/software/maven/apache-maven-3.5.2
24+ export PATH=\$MAVEN_HOME/bin:\$PATH
25+ ```
26+
27+ 执行 ` source /etc/profile ` ,立即生效
28+
29+ (4)检验是否安装成功,执行 ` mvn -v ` 命令
30+
31+ ## 脚本
32+
33+ 以上两种安装方式,我都写了脚本去执行:
34+
35+ | [ 安装脚本] ( https://github.com/dunwu/linux/tree/master/codes/deploy/tool/maven ) |
You can’t perform that action at this time.
0 commit comments