在Debian 11上安装OpenJDK 11(Temurin)

首先

使用Temurin在Debian 11上安装OpenJDK11。
原文链接:OpenJDK各种安装方法和EOL概述。
参考链接:Linux (RPM/DEB) 安装程序包 | Adoptium。

支援

若使用此方法进行部署,可能会导致自 2024 年 10 月之后不再提供对报告的漏洞和问题的支持与修复。

登录

安装

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

# apt update; apt install -y wget apt-transport-https
# mkdir -p /etc/apt/keyrings
# wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
# echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
# apt update
# apt install temurin-11-jdk
... 略

多种确认

# which java
/usr/bin/java

# java -version
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment Temurin-11.0.19+7 (build 11.0.19+7)
OpenJDK 64-Bit Server VM Temurin-11.0.19+7 (build 11.0.19+7, mixed mode)