赞
踩
一开始因为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
结果返回为空,我的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.
后来我直接访问这个地址直接是404
其实直接到官网下载就可以了
这时候你yum makecache肯定是-bash: /usr/bin/yum: No such file or directory
因为你这时候yum依赖
依旧还是没下载下来
到官网下载对应依赖
你也可以直接
[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源还是有问题建议你还是更新一下
切换到yum文件夹
cd /etc/yum.repos.d
将原来的yum源给备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
指定路径下载
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清除缓存
yum clean all
生成缓存
yum makecache
实际测试,可以用了
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。