CentOS7使用yum命令报错

目录结构

    • 前言
    • 使用yum命令,报错信息
    • 问题排查
    • 解决方案
    • 参考文章

在这里插入图片描述

前言

安装CentOS 7 虚拟机,使用yum命令报错,调查整理如下:

使用yum命令,报错信息

在这里插入图片描述

[root@localhost ~]# sudo yum install net-tools
已加载插件: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; 未知的错误"One of the configured repositories failed (未知),and yum doesn't have enough cached data to continue. At this point the onlysafe 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 workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-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 muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64

问题排查

centos7在2024年6月30日,生命周期结束,官方不再进行支持维护,官方的YUM源也下线了,下线的方式是使yum的域名不解析。所以现在需要配置国内的YUM源

  1. 通过ip addr检查了一下网络接口发现没问题;
  2. ping www.baidu.com 正常ping通,没有问题;
  3. 关了一下防火墙也无法解决问题;

解决方案

  1. 编辑“CentOS-Base.repo"
sudo vi /etc/yum.repos.d/CentOS-Base.repo
  1. 将下文信息替换原有内容;
[base]  
name=CentOS-$releasever - Base  
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #released updates   
[updates]  
name=CentOS-$releasever - Updates  
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/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  
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/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  
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  #contrib - packages by Centos Users  
[contrib]  
name=CentOS-$releasever - Contrib  
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/  http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/contrib/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7  # 使用failovermethod指定优先级,这里设置为随机(roundrobin),也可以改为priority并指定每个URL的优先级  
failovermethod=roundrobin
  1. 清理YUM缓存并更新
sudo yum clean all
sudo yum makecache
sudo yum update

参考文章

  1. https://blog.csdn.net/qq_46302361/article/details/140169844

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/870685.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

OPenCV实现直方图均衡化----20240711

# 直方图均衡化import cv2 import numpy as np import matplotlib.pyplot as plt# 读取彩色图像 img = cv2.imread("./pictures/Lena.jpg")# 检查图像是否加载成功 if img is None:print("Could not open or find the i

每天五分钟深度学习:向量化技术在神经网络中的应用

本文重点 向量化技术,简而言之,就是利用矩阵运算(而非传统的for循环)来执行大规模的计算任务。这种技术依赖于单指令多数据(SIMD)架构,允许一个指令同时对多个数据元素执行相同的操作。例如,在向量化加法中,不再需要逐个元素进行加法操作,而是可以一次性对整个向量执…

【电子通识】无源元件与有源元件的定义和区别是什么?

当提到构成电路的电子器件时,许多人可能会想到晶体管、电容器、电感器和电阻器等器件。一般情况下,我们使用的电子器件分为两大类,即“有源元件”和“无源元件”。 有源元件是主动影响(如放大、整流、转换等)所供给电能的元件。 无源元件是对所供给的电能执行被动…

测试驱动开发的艺术:Xcode中实现TDD的全面指南

测试驱动开发的艺术&#xff1a;Xcode中实现TDD的全面指南 在软件开发过程中&#xff0c;测试驱动开发&#xff08;Test-Driven Development&#xff0c;TDD&#xff09;是一种以测试为先导的开发模式&#xff0c;它强调先编写测试用例&#xff0c;再编写功能代码&#xff0c;…

流程图编辑框架LogicFlow-vue-ts和js

LogicFlow官网https://site.logic-flow.cn/LogicFlow 是一款流程图编辑框架&#xff0c;提供了一系列流程图交互、编辑所必需的功能和灵活的节点自定义、插件等拓展机制。LogicFlow支持前端研发自定义开发各种逻辑编排场景&#xff0c;如流程图、ER图、BPMN流程等。在工作审批配…

【zabbix7】开启HTTP authentication实现单点登录

开启HTTP authentication实现单点登录 一、新建http验证用户 htpasswd -c /etc/nginx/.htpasswd another_username # 在提示中输入密码二、新建Nginx配置文件 把zabbix.conf拷贝一份&#xff0c;然后修改listen监听的端口。 cp zabbx.conf zabbix_http.conf 每个location中新…

【Dison夏令营 Day 16】如何使用 Python 中的 PyGame 制作俄罗斯方块游戏

俄罗斯方块(Tetris)是一款经典的益智游戏&#xff0c;游戏的目的是将落下的几何图形片&#xff08;称为 “俄罗斯方块”&#xff09;排列起来&#xff0c;填满水平线&#xff0c;不留空隙。当一条线被完全填满时&#xff0c;它就被清除了&#xff0c;玩家就能获得分数。随着四角…

操作系统——内存管理(面试准备)

虚拟内存 单片机没有操作系统&#xff0c;每次写完代码&#xff0c;都需要借助工具把程序烧录进去&#xff0c;这样程序才能跑起来。 另外&#xff0c;单片机的CPU是直接操作内存的物理地址。 在这种情况下&#xff0c;想在内存中同时运行两个程序是不可能的&#xff0c;如果第…

(CVPR-2024)SwiftBrush:具有变分分数蒸馏的单步文本到图像扩散模型

SwiftBrush&#xff1a;具有变分分数蒸馏的单步文本到图像扩散模型 Paper Title&#xff1a;SwiftBrush: One-Step Text-to-Image Diffusion Model with Variational Score Distillation Paper 是 VinAI Research 发表在 CVPR 24 的工作 Paper地址 Code:地址 Abstract 尽管文本…

Flutter-实现物理小球碰撞效果

效果 引言 在Flutter应用中实现物理动画效果&#xff0c;可以大大提升用户体验。本文将详细介绍如何在Flutter中创建一个模拟物理碰撞的动画小球界面&#xff0c;主要代码实现基于集成sensors_plus插件来获取设备的加速度传感器数据。 准备工作 在开始之前&#xff0c;请确保…

一文详解DDL同步及其应用场景

目录 一、什么是DDL&#xff1f; 二、什么是DDL同步&#xff1f; 三、DDL同步的痛点 1、缺少自动DDL同步机制 2、缺少DDL变更监测预警 四、解决方案 五、应用场景及案例 案例一 案例二 案例三 在现代数据管理中&#xff0c;数据库的结构变更频繁且不可避免&#xff0c;特别是在…

Kubelet 认证

当我们执行kubectl exec -it pod [podName] sh命令时&#xff0c;apiserver会向kubelet发起API请求。也就是说&#xff0c;kubelet会提供HTTP服务&#xff0c;而为了安全&#xff0c;kubelet必须提供HTTPS服务&#xff0c;且还要提供一定的认证与授权机制&#xff0c;防止任何知…

HTTP3.0

HTTP/3是HTTP协议的最新版本&#xff0c;它基于QUIC协议&#xff0c;具有以下特点&#xff1a; 无队头阻塞: QUIC 使用UDP协议来传输数据。一个连接上的多个stream之间没有依赖, 如果一个stream丢了一个UDP包&#xff0c;不会影响后面的stream&#xff0c;不存在 队头阻塞问题…

迪卡斯特拉算法与前式链向星结合的易错点

进行迪克特斯拉算法的时候我们需要标记已经访问过的节点&#xff0c;而这个节点是否访问过的判断也是需要注意的 int dikj() {priority_queue<pair<int, int>> q;int ma 0;//vis[start] 1; // 记录一下 不用写for (int i 0; i < n; i) vis[i] 0,di[i] 0x…

C语言 | Leecode C语言题解之第229题多数元素II

题目&#xff1a; 题解&#xff1a; /*** Note: The returned array must be malloced, assume caller calls free().*//*假定 num1&#xff0c;num2 为出现次数大于 nums.length / 3 的两个数。&#xff08;最多出现两个&#xff09;遍历 nums&#xff0c; 若出现 num1、num2…

《C语言程序设计 第4版》笔记和代码 第十一章 指针和数组

第十一章 指针和数组 11.1 指针和一维数组间的关系 1 由于数组名代表数组元素的连续存储空间的首地址&#xff0c;因此&#xff0c;数组元素既可以用下标法也可以用指针来引用。 例11.1见文末 2 p1与p在本质上是两个不同的操作&#xff0c;前者不改变当前指针的指向&#xf…

无人机之遥控器保养

一、使用存放 1、避免让遥控器受到强烈的震动或从高处跌落&#xff0c;以免影响内部结构的精度&#xff1b; 2、遥控器在使用完后&#xff0c;需要将天线收拢&#xff0c;避免折断&#xff0c;养成定期检查天线的习惯&#xff1b; 3、定期检查遥控器按键有无裂纹、畸变、松旷…

LiteOS GPIO中断处理

在LiteOS系统里主要使用IoTGpioRegisterIsrFunc函数注册GPIO的中断&#xff1a; 函数原型&#xff1a; unsigned int IoTGpioRegisterIsrFunc(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity, GpioIsrCallbackFunc func, char *arg)参数功能&#…

vue + Lodop 实现浏览器自动打印 无需预览打印

官网地址&#xff1a;https://www.lodop.net/download.html 先去Lodop官网下载相应的安装包 解压安装将LodopFuncs.js放在项目中utils文件夹中加一行代码 export { getLodop }; //导出<template><div><div class"main"><ul class"btns&qu…

ISO/OIS的七层模型②

OSI模型是一个分层的模型&#xff0c;每一个部分称为一层&#xff0c;每一层扮演固定的角色&#xff0c;互不干扰。OSI有7层&#xff0c;从上到下分别是&#xff1a; 一&#xff0c;每层功能 7.应用层&#xff08;Application layer &#xff09;&#xff1a;应用层功能&#x…