1. 报错信息:
在使用docker构建mysql容器时,发现无法使用yum安装mysql-server
[root@fd729b2ea367 /]# yum -y install mysql mysql-server
Loaded plugins: fastestmirror, ovl
Setting up Install Process
Loading mirror speeds from cached hostfile
* epel: dl.fedoraproject.org
Package mysql-community-client-5.7.36-1.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.36-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.36-1.el6 for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1(libnuma_1.1)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1(libnuma_1.2)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1()(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-common.x86_64 0:5.7.35-1.el6 will be updated
---> Package mysql-community-common.x86_64 0:5.7.36-1.el6 will be an update
---> Package mysql-community-server.x86_64 0:5.7.36-1.el6 will be installed
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1(libnuma_1.1)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1(libnuma_1.2)(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Processing Dependency: libnuma.so.1()(64bit) for package: mysql-community-server-5.7.36-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libaio.so.1(LIBAIO_0.1)(64bit)
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libnuma.so.1(libnuma_1.2)(64bit)
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libnuma.so.1()(64bit)
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libnuma.so.1(libnuma_1.1)(64bit)
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libaio.so.1()(64bit)
Error: Package: mysql-community-server-5.7.36-1.el6.x86_64 (mysql57-community)
Requires: libaio.so.1(LIBAIO_0.4)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
2. 原因分析:
-
我这次测试使用的docker镜像是,网易云提供的基础 centos 镜像,该版本是 centos:6.7
https://c.163yun.com/hub#/library/repository/info?repoId=1055
FROM hub.c.163.com/public/centos:6.7
-
CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life),官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。
-
不过有一些老设备依然需要维持在当前系统,CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了各个版本软件源的镜像,只是这个软件源不会再有更新了
3. 解决方法:
复制运行以下代码:
sed -i “s|enabled=1|enabled=0|g” /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all
yum makecache