当前位置: 首页 > article >正文

CentOS7 yum 报错解决方案

1.不良代码:

[root@hcss-ecs-a901 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh 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: centos-sclo-rh/x86_64

2.处理方法:

1.备份文件:CentOS-Base.repo

cd /etc/yum.repos.d

2.替换文件内容:

[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

3.重新生成缓存:

yum clean all
yum makecache

参考大佬文献:【CentOS7.6】yum 报错:Could not retrieve mirrorlist http://mirrorlist.centos.org_yum makecache loaded plugins: fastestmirror determ-CSDN博客


http://www.kler.cn/a/290665.html

相关文章:

  • Git 树形图表不显示问题
  • Linux硬盘分区 --- 挂载分区mount、卸载分区umount、永久挂载
  • 如何使用Python自动化发送消息:用pynput库批量输入并发送文本
  • NSGA-II(非支配排序遗传算法II)详解与实现
  • Pytorch使用手册-DCGAN 指南(专题十四)
  • springboot525基于MVC框架自习室管理和预约系统设计与实现(论文+源码)_kaic
  • FFmpeg源码:get_audio_frame_duration、av_get_audio_frame_duration2函数分析
  • Splasthop 安全远程访问帮助企业对抗 Cobalt Strike 载荷网络攻击
  • 鸿蒙(API 12 Beta6版)图形【NativeImage开发指导 (C/C++)】方舟2D图形服务
  • git---gitignore--忽略文件
  • 【C++】对比讲解构造函数和析构函数
  • 智能优化特征选择|基于鲸鱼WOA优化算法实现的特征选择研究Matlab程序(KNN分类器)
  • idea对项目中的文件操作没有权限
  • 海外合规|新加坡网络安全认证计划简介(三)-Cyber Trust
  • SpringBoot+Redis极简整合
  • springboot集成七牛云上传文件
  • Python画笔案例-030 实现打点之斜正方
  • MATLAB 中的对数计算
  • torch、torchvision、torchtext版本兼容问题
  • ubuntu 22.04安装NVIDIA驱动和CUDA
  • 传统CV算法——基于 SIFT 特征点检测与匹配实现全景图像拼接
  • Java实现根据某个字段对集合进行去重并手动选择被保留的对象
  • vuex 基础使用
  • 网页版修改本地数据器:重新布局,引入 highlight.js高亮显示代码
  • 鸿蒙Next-拉起支付宝的三种方式——教程
  • 【Linux】理解Linux中的软链接与硬链接