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


相关文章
|
17天前
|
监控 Linux
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
53 13
yum install -y net-snmp-devel 安装不成功 zabbix项目安装,Errors during downloading metadata for repository ‘extras-common’:问题解决方案-优雅草卓伊凡
|
6月前
|
网络协议 Linux
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org;"之解决办法(换源)
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
|
7月前
|
缓存 安全 网络协议
【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
1312 1
|
7月前
|
缓存 Linux 开发工具
docker的centos容器使用yum报错
docker的centos容器使用yum报错
282 0
|
8月前
|
弹性计算 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
350 0
|
9月前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
616 1
|
9月前
|
Python
yum 安装报错 File "/usr/bin/yum", line 30
yum 安装报错 File "/usr/bin/yum", line 30
187 0
|
9月前
yum 报错:Another app is currently holding the yum lock; waiting for it to exit
开发过程中需要用到 yum 命令 有时候执行 yum 会报错如下
170 0
|
5天前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
54 25
|
3月前
|
存储 缓存 Linux
【Linux】另一种基于rpm安装yum的方式
通过本文的方法,您可以在离线环境中使用RPM包安装YUM并进行必要的配置。这种方法适用于无法直接访问互联网的服务器或需要严格控制软件源的环境。通过配置本地YUM仓库,确保了软件包的安装和更新可以顺利进行。希望本文能够为您在特定环境中部署YUM提供实用的指导。
383 0