本文章基于 Debian 或 Ubuntu 系统。
1. 安装基础包
sudo apt install -y wget apt-transport-https gpg
2. 下载 Eclipse Adoptium GPG Key
sudo wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null
3. 添加 Eclipse Adoptium apt 仓库
sudo echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
4. 安装所需 JDK 版本
sudo apt udpate
sudo apt install temurin-21-jdk
JDK 版本说明及样例
temurin-<version>-jdk
e.g temurin-17-jdk or temurin-8-jdk
5. 检查 JDK
java --version