Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stoc

简介: CentOS 默认的镜像源可能无法访问。可以更换为其他镜像源,例如阿里云、腾讯云等。

出现错误

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

CentOS 默认的镜像源可能无法访问。可以更换为其他镜像源,例如阿里云、腾讯云等。

解决方法

1. 备份 YUM 配置文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

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

3. 创建和刷新 YUM 缓存

yum makecache

参考资料

阿里云开源centos镜像源:https://developer.aliyun.com/mirror/centos

目录
相关文章
|
Linux
通过HTTP方式自建CentOS系列Yum源
通过HTTP方式自建CentOS系列Yum源
213 0
|
网络协议 Linux 应用服务中间件
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
2022红帽企业版网络配置--centos7配置DHCP DNS绑定域名 FTP HTTP(apache) nginx samba
221 0
|
6月前
|
缓存 负载均衡 应用服务中间件
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
185 1
如何在 CentOS 7 上为 NGINX 安装开源 HTTP 加速器:Varnish
|
6月前
|
分布式计算 关系型数据库 MySQL
Sqoop【部署 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
【2月更文挑战第8天】Sqoop CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
255 1
|
6月前
|
Java Linux
Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
【2月更文挑战第16天】Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
128 0
|
6月前
|
安全 Linux Anolis
centos停止更新?这篇博客教会你CentOS 7转化系统为阿里龙蜥Anolis OS 7
centos停止更新?这篇博客教会你CentOS 7转化系统为阿里龙蜥Anolis OS 7
692 0
|
6月前
|
关系型数据库 MySQL Linux
Azkaban【部署 02】CentOS release 7.5安装配置azkaban-3.70.0安装阶段(含已编译的10个安装文件:可直接进行安装)
【2月更文挑战第5天】CentOS release 7.5安装配置azkaban-3.70.0安装阶段(含已编译的10个安装文件:可直接进行安装)
103 7
|
6月前
|
分布式计算 Hadoop Java
Hadoop【环境搭建 01】【hadoop-3.1.3 单机版】【Linux环境 腾讯云 CentOS Linux release 7.5.1804】【详细】
Hadoop【环境搭建 01】【hadoop-3.1.3 单机版】【Linux环境 腾讯云 CentOS Linux release 7.5.1804】【详细】
116 0
|
6月前
|
Java Linux 开发工具
Azkaban【部署 01】Linux环境 CentOS Linux release 7.5.1804安装配置azkaban-3.70.0编译阶段(附安装包及gradle-4.6资源)
【2月更文挑战第4天】Linux环境 CentOS Linux release 7.5.1804安装配置azkaban-3.70.0编译阶段(附安装包及gradle-4.6资源)
140 1
下一篇
无影云桌面