Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

 

001、centos8 中yum安装软件出现如下报错

Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

 

002、系统

[root@localhost test01]# hostnamectl        ## 系统
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 47ab431cf1c54a55ac168f9d37795125
           Boot ID: 46f1cb3d6ca1416b9c23a3a776f94408
    Virtualization: vmware
  Operating System: CentOS Linux 8
       CPE OS Name: cpe:/o:centos:centos:8
            Kernel: Linux 4.18.0-305.3.1.el8.x86_64
      Architecture: x86-64

 

003、问题原因

centos8已经 停止维护

 

004、解决方法

a、进入yum仓库配置文件目录

[root@localhost test01]# cd /etc/yum.repos.d/        ## 进入yum仓库配置文件目录
[root@localhost yum.repos.d]# ls
CentOS-Linux-AppStream.repo          CentOS-Linux-FastTrack.repo
CentOS-Linux-BaseOS.repo             CentOS-Linux-HighAvailability.repo
CentOS-Linux-ContinuousRelease.repo  CentOS-Linux-Media.repo
CentOS-Linux-Debuginfo.repo          CentOS-Linux-Plus.repo
CentOS-Linux-Devel.repo              CentOS-Linux-PowerTools.repo
CentOS-Linux-Extras.repo             CentOS-Linux-Sources.repo

 

b、修改配置文件内容:

[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' CentOS-*   ## 注释掉 mirrorlist
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' CentOS-*
## 使baseurl生效,并修改域名

 

c、测试安装效果

[root@localhost yum.repos.d]# yum -y install httpd         ## 安装测试

 

问题解决。

 

posted @ 2024-04-04 22:07  小鲨鱼2018  阅读(29)  评论(0编辑  收藏  举报