错误:为仓库 'AppStream' 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs in mirrorlist
目录
一、域名解析
二、CentOS-AppStream.repo
三、CentOS-Base.repo
四、CentOS-Extras.repo
五、rpm更新
一、域名解析
先验证 ping www.baidu.com 不ok则添加域名解析,ok的页建议
[root@localhost ~]# vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 114.114.114.114
重启网络服务,如有启动不成功(centos版本问题,不支持,)
添加镜像源,并更新rpm
不支持:
[root@localhost ~]# service network restart
Redirecting to /bin/systemctl restart network.service
则尝试:service networking restart 或者
[root@localhost yum.repos.d]# nmcli c reload
二、CentOS-AppStream.repo
#[AppStream]
#name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
三、CentOS-Base.repo
#[BaseOS]
#name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial[BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
四、CentOS-Extras.repo
#additional packages that may be useful
[extras]
#name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficialname=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
五、rpm更新
[root@localhost yum.repos.d]# dnf update dnf rpm -y
六、再次尝试之前的命令
如docker安装:
sudo yum install -y yum-utils