首页 > 系统相关 >使用yum安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&

使用yum安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&

时间:2024-10-06 14:44:45浏览次数:1  
标签:retrieve centos CentOS http repo mirrorlist 报错 org

安装wget命令

yum -y install wget
报错,无法找到镜像

 


测试是否是网络问题

抓包正常,网络没有问题;尝试更新yum

又开始报错


尝试分析问题原因
出现这个错误是因为使用的 CentOS 7 仓库已经被归档,当前的镜像地址无法找到所需的文件。CentOS 7 的官方支持已经结束,部分仓库已被移至归档库。这导致了你的 yum 命令无法找到所需的元数据文件。CentOS 7 的官方仓库在 2024 年 6 月 30 日之后已经停止维护。因此,使用最新的 CentOS 7 官方仓库可能会遇到问题。


尝试解决:


进入/etc/yum.repos.d目录下找到 CentOS-Base.rep

执行

cp CentOS-Base.repo CentOS-Base.repo.backup
修改 CentOS-Base.repo 为

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# 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, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#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/centos/$releasever/extras/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

wq保存,再执行

sudo yum clean all
sudo yum makecache

等待加载成功;

然后继续执行

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
然后执行

cat CentOS-Base.repo`
发现镜像已改为了阿里云的

再此尝试导入wget命令 好的成功了


原文链接:https://blog.csdn.net/weixin_62746478/article/details/140794107

标签:retrieve,centos,CentOS,http,repo,mirrorlist,报错,org
From: https://www.cnblogs.com/dzcWeb/p/18449054

相关文章

  • 如何解决 构建dotnet docker镜像时报错:error NU1301: Unable to load the service ind
    我用的是dockerdesktop,Builders设置:desktop-linux以下是我的dotnet项目的Dockerfile内容FROMmcr.microsoft.com/dotnet/aspnet:6.0ASbaseWORKDIR/appEXPOSE80EXPOSE443FROMmcr.microsoft.com/dotnet/sdk:6.0ASbuildWORKDIR/srcCOPY["NuGet.Config","......
  • PHP报错getimagesize(): SSL operation failed with code 1问题解决方案
    这个PHP错误通常发生在尝试通过HTTPS协议获取图像时,由于缺少或过期的CA证书导致SSL连接验证失败。以下是详细的解决方案:解决方案一:更新CA证书下载最新的CA证书访问 curl官方提供的CA证书 页面下载 cacert.pem 文件。上传证书文件将下载的 cacert.......
  • 帝国CMS7.5使用PHP7.x环境登录后台报错的解决方法!
    遇到EmpireCMS7.5在PHP7.x环境下登录后台报错的问题,可以通过以下步骤来解决:1.修改数据库接口类型全新安装EmpireCMS时在安装过程中选择MySQL接口类型为 mysqli。已经安装好的EmpireCMS修改配置文件 /e/config/config.php,将数据库接口类型从 mysql 改为 m......
  • 本地环境PHP帝国备份王备份报错mysql_escape_string(): This function is
    在使用帝国备份王进行备份和恢复时,如果遇到PHP5.5环境下的报错,通常是因为一些旧的MySQL函数已经被弃用或移除。具体来说,mysql_escape_string 函数在PHP5.5中已经被废弃,应该使用 mysql_real_escape_string 替代。解决方案定位问题文件:找到 function.php 文件的位置。......
  • 帝国CMS建立模型字段报错:Row size too large. The maximum row size for the
    在帝国CMS中建立模型字段时,如果字段过多或单个字段过长,可能会遇到MySQL报错“Rowsizetoolarge”。这个错误是因为MySQL表的最大行大小限制为65535字节(不包括BLOB和TEXT类型字段)。解决这个问题的方法是将一些字段转换为TEXT或BLOB类型。解决方案分析现有字段......
  • ROS报错The target name "test" is reserved when CTest testing is enabled
    ROS报错“Thetargetname“test“isreservedwhenCTesttestingisenabled”注意:现有特殊情况,可执行文件名可以为test,但是映射名称不可以为test。一般认为,可执行文件名和映射名称同名。因为映射名称不可命名为test,故可执行文件最好不要命名为test。纠正:ROS遇到的问题......
  • 帝国CMS后台添加信息报错Duplicate entry xx for key PRIMARY
    当在帝国CMS后台添加信息时遇到 Duplicateentry'xx'forkey'PRIMARY' 的错误时,通常是因为主键冲突。以下是一些解决该问题的方法:方法1:后台修复数据库进入后台:登录帝国CMS后台。进入 系统 -> 备份与恢复数据 -> 备份数据。修复数据表:在页面底部,找到 修复......
  • DBeaver 连接 mysql 报错:Public Key Retrieval is not allowed
    前言DBeaver连接mysql报错:PublicKeyRetrievalisnotallowed遇到"PublicKeyRetrievalisnotallowed"错误时,通常意味着你正在使用的身份验证方法需要加密连接,但是没有正确地配置客户端或服务器来支持这种加密。解决第一种可以在连接字符串中添加 allowPublicKey......
  • pbootcms模板报错提示PHP Warning: Unknown: open_basedir restriction
    当PbootCMS模板出现报错提示 PHPWarning:Unknown:open_basedirrestrictionineffect.File 时,通常是因为PHP的 open_basedir 限制设置不当。以下是解决该问题的简要步骤:解决步骤检查PHP配置文件(php.ini):确认 open_basedir 设置是否正确。修改 open_b......
  • 卸载时报错:‘’系统找不到指定的驱动器‘’问题处理
    操作系统:win11问题描述:wegame,英雄联盟我早就卸载过了,今天在设置/应用/安装的应用这里又看见了,在此处点击卸载,报如下错误:解决办法:查了一下网上的做法,大多数是删除注册表,我也试了几个,结果还是没有用。最后灵机一动,记得控制面板那边也有卸载应用的位置。控制面板/程序/卸载......