在官网查看各版本下载地址
https://gradle.org/releases/
cd /usr/local #进入安装目录
wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip #下载Gradle
unzip gradle-6.8.3-bin.zip #解压
mv gradle-6.8.3 gradle #重命名
rm -rf gradle-6.8.3-bin.zip #删除压缩包
vim /etc/profile #编辑/etc/profile
/etc/profile添加
export PATH=$PATH:/usr/local/gradle/bin
source /etc/profile #使其生效
gradle --version #查看Gradle版本,验证是否安装成功
输出
Welcome to Gradle 6.8.3!
Here are the highlights of this release:
- Faster Kotlin DSL script compilation
- Vendor selection for Java toolchains
- Convenient execution of tasks in composite builds
- Consistent dependency resolution
For more details see https://docs.gradle.org/6.8.3/release-notes.html
------------------------------------------------------------
Gradle 6.8.3
------------------------------------------------------------
Build time: 2021-02-22 16:13:28 UTC
Revision: 9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_211 (Oracle Corporation 25.211-b12)
OS: Linux 3.10.0-1127.13.1.el7.x86_64 amd64
安装成功