前言
本文适用于 CentOS/Debian/Ubuntu 等 Linux 发行版系统。
JDK 安装
由于 Gradle 的运行依赖于 JDK,但是安装 Oracle JDK 不是必需的,如果不想安装可以使用 Open-JDK 替代,而且大多数 Linux 发行版自带 Open-JDK。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| # wget -P /usr/local --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3a%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk8-downloads-2133151.html; oraclelicense=accept-securebackup-cookie;" "https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk1.8.0_201-linux-x64.tar.gz"
# tar -xvf /usr/local/jdk1.8.0_201-linux-x64.tar.gz
# rm /usr/local/jdk1.8.0_201-linux-x64.tar.gz
# ln -s -f /usr/local/jdk1.8.0_201/bin/java /usr/bin/java # ln -s -f /usr/local/jdk1.8.0_201/bin/javac /usr/bin/javac
# vim /etc/profile JAVA_HOME=/usr/local/jdk1.8.0_201 JRE_HOME=/usr/local/jdk1.8.0_201/jre CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASSPATH PATH
# source /etc/profile
# javac -version javac 1.8.0_201
# java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
|
Gradle 下载
Gradle 安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| # wget https://downloads.gradle.org/distributions/gradle-5.4.1-bin.zip
# unzip -d /usr/local gradle-5.4.1-bin.zip
# vim /etc/profile GRADLE_HOME=/usr/local/gradle-5.4.1 PATH=$PATH:$GRADLE_HOME/bin export GRADLE_HOME PATH
# source /etc/profile
# gradle -v
|