备份文件:

# 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
#baseurl=http://mirror.centos.org/centos/$releasever/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
#baseurl=http://mirror.centos.org/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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

进入yum.repos.d目录下

cd /etc/yum.repos.d/

替换CentOS-Base.repo文件内容。

# 执行下面命令报错

yum clean all
yum makecache

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

参考文章:

https://blog.csdn.net/qq_32448349/article/details/97751497

https://blog.csdn.net/young_foryou/article/details/86547583?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

# 进入网络配置
cd /etc/sysconfig/network-scripts/ # 查看自己本机的网卡,在终端中执行命令:
nmcli d

修改ifcfg-enp2s0的配置:

# 再重启
systemctl restart network

但是再运行yum还是报错:

curl#6 - "Could not resolve host: apt.sw.be; 未知的错误"

参开解决办法:https://blog.csdn.net/feiz3020/article/details/79812798?utm_source=blogxgwz9

安装好了!!

【CentOS7】之执行yum命令报错的更多相关文章

  1. 执行yum命令报错"Unable to connect to Registration Management Service"

    问题描述 linux上执行yum相关命令时,报无法连接到注册管理服务的错误,具体报错信息如下 [root@aijihe-core-zy-2-3 ~]# yum install gcc Loaded p ...

  2. Linux执行YUM命令报错解决方案

    Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disa ...

  3. 树莓派(Raspberry Pi 3) centos7使用yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:

    使用yum命令报错 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^SyntaxError: invalid ...

  4. Python3安装Celery模块后执行Celery命令报错

    1 Python3安装Celery模块后执行Celery命令报错 pip3 install celery # 安装正常,但是执行celery 命令的时候提示没有_ssl模块什么的 手动在Python解 ...

  5. 使用yum命令报错

    树莓派(Raspberry Pi 3) centos7使用yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, ...

  6. Centos下使用yum命令报错 except KeyboardInterrupt, e: SyntaxError: invalid syntax

    使用yum命令报错 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid ...

  7. yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:

    使用yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: 问题出现原因:yum包管理是使用python2 ...

  8. CentOS yum命令报错 Error: File /var/cache/yum/i386/6/epel/metalink.xml does not exist

    最近在虚拟机上执行yum命令一直报错:Could not parse metalink https://mirrors.fedoraproject.org/metalink?repo=epel-7&a ...

  9. yum命令报错 yum update File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: --CentOS7.5

    1.问题: 使用yum命令如:yum update 报SyntaxError invalid syntax 2.原因分析 yum的解释器是Python,CentOS自带的yum采用(自带的)pytho ...

  10. 关于使用AWS上的RHEL-8.x/Redhat系统使用自己单独购买的Redhat官网license导致的yum命令报错处理

    我们在aws上使用市场提供的RHEL-8.x系统后,license相关的都是由aws官网一起提供了 最近笔者将aws上一台作过系统加固的RHEL-8.x导出到自己本地DC环境,也注册了Redhat官网 ...

随机推荐

  1. KES数据库实践指南:探索KES数据库的事务隔离级别

    引言 前两篇文章我们详细讲解了如何安装KES金仓数据库,并提供了快速查询和搭建基于coze平台的智能体的解决方案.今天,我们的焦点将放在并发控制机制和事务隔离级别上. 本文将通过一系列实验操作,深入探 ...

  2. python3 安装pymssql失败 pip3 install pymssql

    python3 安装pymssql失败 报错信息: AttributeError: module 'platform' has no attribute 'linux_distribution' 解决 ...

  3. vol2以及mimikatz插件安装教程

    volatility2安装 https://github.com/volatilityfoundation/volatility git clone https://github.com/volati ...

  4. 7.条件渲染if

    v-if v-if 指令用于条件性地渲染一块内容.这块内容只会在指令的表达式返回 truthy 值的时候被渲染. <h1 v-if="awesome">Vue is a ...

  5. Mybatis ResultMap复杂对象一对一查询结果映射之association

    Mybatis复杂对象映射配置ResultMap的association association:映射到POJO的某个复杂类型属性,比如订单order对象里面包含user对象 表结构 项目结构 pom ...

  6. HOOK别人的dylib(HOOK cydia里面的插件)

    以下仅做我在hook 中的记录, 环境 VM PRO 15 MAC OS 15 Xcode 11.2 工具 monkeydev install_name_tool otool 思路:将要hook 的d ...

  7. Python 潮流周刊第 2 季完结了,分享几项总结

    我订阅了很多的周刊/Newsletter,但是发现它们都有一个共同的毛病:就是缺乏对往期内容的整理,它们很少会对内容数据作统计分析,更没有将内容整理成合集的习惯. 在自己开始连载周刊后,我就想别开生面 ...

  8. oeasy教您玩转vim - 48 - # ed由来

    ​ 范围控制 回忆上节课内容 我们这次研究了mark的定义和使用 mb定义 'b跳转 可以对marks,查询删除 三种marks 小写 本文件内 大写 跨文件 数字 配置文件中 甚至可以在行编辑中,使 ...

  9. 题解:CF1971C Clock and Strings

    题解:CF1971C Clock and Strings 题意 在上图的一个圆中,给予你四个点 \(a,b,c,d\),判断线段 \(ab\) 与线段 \(cd\) 是否相交. 思路 先设置一个字符串 ...

  10. 微软CrowdStrike驱动蓝屏以及内核签名

    原因 当Windows操作系统遇到严重错误导致系统崩溃时,屏幕显示为蓝色,通常伴有错误代码和信息,这被称为"蓝屏死机"(Blue Screen of Death,简称BSOD) h ...