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 http://mirrors.cloud.tencent.com/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=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=Qcloud centos AppStream - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/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


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

 

相关文章
|
2月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
459 16
|
6月前
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
1519 29
|
9月前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
955 25
|
10月前
|
缓存 Linux 数据库
CentOS 8中 更新或下载时报错:为仓库 ‘appstream‘ 下载元数据失败 : Cannot prepare internal
通过以上步骤,您可以有效地解决 CentOS 8 中“为仓库 ‘appstream’ 下载元数据失败 : Cannot prepare internal”问题。关键在于检查网络连接、更新和切换仓库配置、清理缓存、重建 RPM 数据库以及在必要时临时禁用有问题的仓库。通过这些方法,可以确保系统能够正常进行软件包的更新和下载操作。
2757 20
|
10月前
|
缓存 Linux
CentOS-6的iso下载地址镜像yum源
通过上述步骤,您可以成功下载CentOS 6的ISO镜像文件,并配置适用于CentOS 6的YUM源。尽管CentOS 6已经停止更新,但使用这些镜像和YUM源配置,可以继续在需要的环境中使用和维护CentOS 6系统。
4777 20
|
10月前
|
Linux
CentOs9 yum源出现404问题
CentOs9-stream yum源出现404问题
|
11月前
|
缓存 Linux
解决CentOS 7停止更新后yum源失效问题【图文教程】
以上步骤完成后,你的 CentOS 7 系统就会使用阿里云的 yum 源,更换yum以后就可以正常使用啦。
9726 2
|
缓存 Linux
CentOS7配置阿里yum源 超详细!!!
CentOS7配置阿里yum源 超详细!!!
33151 2
|
缓存 Linux
Centos7配置国内yum源和epel源
Centos7配置国内yum源和epel源
18307 3