Step1: 查看&删除已经安装的yum包
rpm -qa | grep yum
rpm -qa | grep yum | xargs | rpm -e --nodeps
Step2: 查看系统的版本号
uname -a
cat /etc/redhat-release
Step3: 用centos相应文件替换RedHat的yum
Step4: 安装centos的rpm文件,yum源安装完成
rpm -ivh yum-4.7.0-4.el8.noarch.rpm yum-utils-4.0.21-3.el8.noarch.rpm --nodeps
Step5: 下载安装相应版本的repo文件
rpm -ivh epel-release-latest-8.noarch.rpm
Step6: 编辑配置repo文件
[BaseOS]
name=BaseOS
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=0
enable=1
[Appstream]
name=AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
enable=1
gpgcheck=0
[epel]
name=EPEL
baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/
gpgcheck=0
Step7:更新软件包缓存
Step8: 验证
yum install -y tree
4.1.1 参考链接
4.1.2 操作总结
Step1 : 卸载旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
Step2 : 设置仓库并使用阿里源
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Step 3: 提前解决在RHEL8.8中会碰到的问题 🎯
rpm -q podman
dnf remove podman
rmp -qa | grep runc
yum remove runc
Step 4: 安装 Docker Engine-Community
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Step 5: 启动Docker并测试
启动
sudo systemctl start docker
执行
sudo docker run hello-world
结果
[root@localhost yum.repos.d]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:ac69084025c660510933cca701f615283cdbb3aa0963188770b54c31c8962493
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
[root@localhost yum.repos.d]# sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
Repository epel is listed more than once in the configuration
Docker CE Stable - x86_64 36 kB/s | 52 kB 00:01
错误:
问题 1: 安装的软件包的问题 podman-3:4.4.1-8.module+el8.8.0+18438+15d3aa65.x86_64
- 软件包 podman-3:4.4.1-8.module+el8.8.0+18438+15d3aa65.x86_64 需要 runc >= 1.0.0-57,但没有提供者可以被安装
- 软件包 podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64 需要 runc >= 1.0.0-57,但没有提供者可以被安装
- 软件包 containerd.io-1.6.26-3.1.el8.x86_64 与 runc(由 runc-1:1.1.4-1.module+el8.8.0+18060+3f21f2cc.x86_64 提供)冲突
- 软件包 containerd.io-1.6.26-3.1.el8.x86_64 淘汰了 runc 提供的 runc-1:1.1.4-1.module+el8.8.0+18060+3f21f2cc.x86_64
- 软件包 containerd.io-1.6.26-3.1.el8.x86_64 与 runc(由 runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64 提供)冲突
- 软件包 containerd.io-1.6.26-3.1.el8.x86_64 淘汰了 runc 提供的 runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- 无法为该任务安装最佳候选
- 软件包 runc-1.0.0-66.rc10.module_el8.5.0+1004+c00a74f5.x86_64 被模块过滤过滤掉
- 软件包 runc-1.0.0-72.rc92.module_el8.5.0+1006+8d0e68a2.x86_64 被模块过滤过滤掉
......
rpm -q podman
dnf remove podman
rmp -qa | grep runc
yum remove runc
[root@localhost yum.repos.d]# sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
Repository epel is listed more than once in the configuration
上次元数据过期检查:0:10:25 前,执行于 2023年12月23日 星期六 20时36分51秒。
依赖关系解决。
===============================================================================================================================================================================================================================
软件包 架构 版本 仓库 大小
===============================================================================================================================================================================================================================
安装:
containerd.io x86_64 1.6.26-3.1.el8 docker-ce-stable 35 M
docker-ce x86_64 3:24.0.7-1.el8 docker-ce-stable 24 M
docker-ce-cli x86_64 1:24.0.7-1.el8 docker-ce-stable 7.2 M
docker-compose-plugin x86_64 2.21.0-1.el8 docker-ce-stable 13 M
安装依赖关系:
container-selinux noarch 2:2.167.0-1.module_el8.5.0+911+f19012f9 Appstream 54 k
libcgroup x86_64 0.41-19.el8 BaseOS 70 k
安装弱的依赖:
docker-buildx-plugin x86_64 0.11.2-1.el8 docker-ce-stable 13 M
事务概要
===============================================================================================================================================================================================================================
安装 7 软件包
总下载:92 M
安装大小:354 M
确定吗?[y/N]: y