Ubuntu24.04安装Temurin JDK
以下命令来自官方,需要使用root身份
切换到root
1 | sudo -i |
安装软件依赖
1 | apt install -y wget apt-transport-https gpg |
下载GPG key
1 | wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor | tee /etc/apt/trusted.gpg.d/adoptium.gpg > /dev/null |
设置apt软件源
1 | echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list |
安装Temurin JDK
1 | apt update |
设置默认的java版本
1 | sudo update-alternatives --config java |