YUM重装遇到的问题和解决方法:已发出 HTTP 请求,正在等待回应... 404 Not Found 2023-10-25 10:33:43 错误 404:Not Found。

#前言
使用虚拟机中的yum相关命令时出现多个错误,几番修改之后,决定删除yum,并重装

#因为下面这个错误决定重装

已加载插件:fastestmirror, langpacks
Determining fastest mirrors
file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
正在尝试其它镜像。


 One of the configured repositories failed (local),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=local ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable local
        or
            subscription-manager repos --disable=local

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=local.skip_if_unavailable=true

failure: repodata/repomd.xml from local: [Errno 256] No more mirrors to try.
file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
[root@master yum.repos.d]# 已加载插件:fastestmirror, langpacks
bash: 已加载插件:fastestmirror,: 未找到命令...
[root@master yum.repos.d]# Loading mirror speeds from cached hostfile
bash: Loading: 未找到命令...
[root@master yum.repos.d]# file:///mnt/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/repodata/repomd.xml"
bash: file:///mnt/repodata/repomd.xml:: 没有那个文件或目录
[root@master yum.repos.d]# 正在尝试其它镜像。^C
[root@master yum.repos.d]# ls /mnt/repodata/repomd.xml
ls: 无法访问/mnt/repodata/repomd.xml: 没有那个文件或目录
[root@master yum.repos.d]# nano /etc/yum.repos.d/local.repo
[root@master yum.repos.d]# less local.repo

#重装的步骤
##删除之前的yum
###删除旧的yum

rm  -rf  /etc/yum.repos.d/*

###卸载相应的版本,所以先查看版本,再卸载查到的版本

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

###卸载组件

rpm -qa | grep yum | xargs rpm -e --nodeps

###查询是否还存在

rpm -qa yum

##安装新的yum
###使用代码wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 出现错误:

bash: [root@linux-node3: 未找到命令...
[root@master ~]# [root@linux-node3 ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm
bash: [root@linux-node3: 未找到命令...
[root@master ~]#  wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-167.el7.centos.noarch.rpm
--2023-10-25 10:33:42--  http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-167.el7.centos.noarch.rpm
正在解析主机 mirror.centos.org (mirror.centos.org)... 44.0.0.176, 44.0.0.176
正在连接 mirror.centos.org (mirror.centos.org)|44.0.0.176|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 404 Not Found
2023-10-25 10:33:43 错误 404:Not Found。

###解决方案一:检查网络的连接

【1】确保是root用户
【2】输入命令,之后回车:cd /etc/sysconfig/network-scripts 
【3】输入命令找到网卡配置文件:ls -a
【4】我的配置文件时“ifcfg-ens32”,输入命令后回车 vi ifcfg-ens33 ,点击 i 进行vi编辑
【5】查看ONBOOT对应的是yes还是no,如果是no改为yes;如果是yes,证明不是这个问题
【6】:wq保存当前修改,退出vi

###解决方案二:
####导致原因:wget命令中访问的网址有问题,无法打开或者没有下载
####解决:使用新的镜像网站,如阿里,命令如下:

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值