yum clean all 后导致yum报错排查解决方案

简介: yum clean all 后导致yum报错排查解决方案

1、yum clean all 后导致yum报错

一开始因为yum找不到包,所以打算更新一下yum仓库,结果遇到坑的博客直接yum不能使用了

使用yum update报错


[root@iZbp17aznee2whyk4k44vjZ ~]# yum update httpd
base                                                                                                                                                                                                                        | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                      | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                     | 2.9 kB  00:00:00     
No packages marked for update

感觉是yum的仓库给清理里没有包了


[root@iZbp17aznee2whyk4k44vjZ ~]# yum update httpd-tools
Resolving Dependencies
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-90.el7.centos will be updated
--> Processing Dependency: httpd-tools = 2.4.6-90.el7.centos for package: httpd-2.4.6-90.el7.centos.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos.5 will be an update
--> Finished Dependency Resolution
Error: Package: httpd-2.4.6-90.el7.centos.x86_64 (@base)
           Requires: httpd-tools = 2.4.6-90.el7.centos
           Removing: httpd-tools-2.4.6-90.el7.centos.x86_64 (@base)
               httpd-tools = 2.4.6-90.el7.centos
           Updated By: httpd-tools-2.4.6-97.el7.centos.5.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.5
           Available: httpd-tools-2.4.6-95.el7.centos.x86_64 (base)
               httpd-tools = 2.4.6-95.el7.centos
           Available: httpd-tools-2.4.6-97.el7.centos.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos
           Available: httpd-tools-2.4.6-97.el7.centos.1.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.1
           Available: httpd-tools-2.4.6-97.el7.centos.2.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.2
           Available: httpd-tools-2.4.6-97.el7.centos.4.x86_64 (updates)
               httpd-tools = 2.4.6-97.el7.centos.4
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

看到上面最后一句报错让我尝试rpm-Va --nofiles --nodigest


[root@iZbp17aznee2whyk4k44vjZ ~]#rpm -qa|grep yum|xargs rpm -e --nodeps 
warning: /etc/yum/pluginconf.d/fastestmirror.conf saved as /etc/yum/pluginconf.d/fastestmirror.conf.rpmsave
warning: /etc/yum.conf saved as /etc/yum.conf.rpmsave
[root@iZbp17aznee2whyk4k44vjZ ~]# rpm -qa |grep yum

后来到网站上找了几个下载依赖的地址都下载报错

Connecting to centos.ustc.edu.cn (centos.ustc.edu.cn)|202.141.160.110|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-10-19 10:13:06 ERROR 404: Not Found.
1
2
3

后来我直接访问这个地址直接是404

其实直接到官网下载就可以了

这时候你yum makecache肯定是-bash: /usr/bin/yum: No such file or directory

因为你这时候yum依赖

依旧还是没下载下来

2、最终解决方案

到官网下载对应依赖

你也可以直接


[root@iZbp17aznee2whyk4k44vjZ ~]#wget

http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@iZbp17aznee2whyk4k44vjZ ~]#wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
[root@iZbp17aznee2whyk4k44vjZ ~]#wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm


然后你在安装一下


rpm -ivh yum-*

然后看安装结果

成功

yum一下看工具都回来了

如果你的yum源还是有问题建议你还是更新一下


3、更新yum源

切换到yum文件夹


cd /etc/yum.repos.d
1

将原来的yum源给备份


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
1

指定路径下载

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1

清除缓存


yum clean all
1

生成缓存


yum makecache
1

实际测试,可以用了


总结

yum工具没了重新安装yum

对应的三个工具

yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

yum-3.4.3-168.el7.centos.noarch.rpm


相关文章
|
2月前
|
网络协议 Linux
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org;"之解决办法(换源)
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
|
3月前
|
缓存 安全 网络协议
【Linux】已解决:There are no enabled repos. Run “yum repolist all” to see the repos you have. You can en
【Linux】已解决:There are no enabled repos. Run “yum repolist all” to see the repos you have. You can en
396 1
|
3月前
|
缓存 Linux 开发工具
docker的centos容器使用yum报错
docker的centos容器使用yum报错
177 0
|
4月前
|
弹性计算 Linux
(已解决) centos6.5 yum源 失效 The whole CentOS 6 is dead and shouldn’t be used anywhere at all
(已解决) centos6.5 yum源 失效 The whole CentOS 6 is dead and shouldn’t be used anywhere at all
231 0
|
5月前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
242 1
|
11月前
|
Linux
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
Centos8安装yum源时候出现的异常问题及解决方案(保好使)
|
5月前
|
Python
yum 安装报错 File "/usr/bin/yum", line 30
yum 安装报错 File "/usr/bin/yum", line 30
129 0
|
5月前
yum 报错:Another app is currently holding the yum lock; waiting for it to exit
开发过程中需要用到 yum 命令 有时候执行 yum 会报错如下
41 0
|
8天前
|
关系型数据库 MySQL Linux
Linux 安装 mysql【使用yum源进行安装】
这篇文章介绍了在Linux系统中使用yum源安装MySQL数据库的步骤,包括配置yum源、安装MySQL服务、启动服务以及修改root用户的默认密码。
Linux 安装 mysql【使用yum源进行安装】
|
2月前
|
关系型数据库 MySQL Linux
在CentOS上使用yum安装与使用MySQL
在CentOS操作系统上使用yum包管理器安装和配置MySQL数据库的详细步骤,包括下载MySQL的yum源配置、安装MySQL服务、启动和停止服务、设置开机自启动、获取临时密码、修改root用户密码、授权用户以及处理相关问题。同时,文章还包含了一些操作的截图,帮助用户更直观地理解安装和配置过程。
368 0
在CentOS上使用yum安装与使用MySQL