##下周jdk17包
# curl -O http://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
# tar xvf jdk-17_linux-x64_bin.tar.gz
Dockerfile
FROM docker.m.daocloud.io/centos:8
# 下载并安装 OpenJDK 17
COPY jdk-17.0.12 /usr/local/jdk
# 设置 JAVA_HOME 环境变量
ENV JAVA_HOME /usr/local/jdk
ENV PATH $JAVA_HOME/bin:$PATH
# 验证安装
RUN java -version
1、进入yum的repos目录
cd /etc/yum.repos.d/
2、下载CentOS 7的repo文件
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3、修改镜像源
vim CentOS-Base.repo
# vim命令模式下执行
:%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g
:%s/$releasever/$releasever-stream/g
4、修改所有的CentOS文件内容
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
5、更新镜像源
清除缓存:yum clean all
生成缓存:yum makecache
6、更新yum:
yum update