备份文件:

# 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. python subprocess读取终端输出内容

    参考链接:https://www.cnblogs.com/songzhenhua/p/9312718.html https://www.cnblogs.com/darkchii/p/9013673.h ...

  2. Redis缓存雪崩,击穿,穿透以及解决方案

    Redis读写过程 一般情况下,Redis都是作为client与MySQL间的一层缓存,尽量减少MySQL的读压力,数据流向如图所示: Redis的五种数据类型及使用场景 String 这个其实没啥好 ...

  3. yb课堂 实战之路由拦截和订单模块 《四十二》

    前置守护 路由拦截功能开发 文档:https://router.vuejs.org/zh/guide/advanced/navigation-guards.html router里面配置需要登陆的路由 ...

  4. Oracle 存储过程 捕获异常

    1.带参数插入并带返回值,异常信息 CREATE OR REPLACE PROCEDURE test_pro (v_id in int,v_name in varchar2,app_code out ...

  5. WebGL加载本地模型

    前言 大部分的webgl框架,比如threejs和babylon等,都可以加载obj和gltf模型. 我们的引擎,基于three封装,同样有加载模型的loader,因此加载obj和gltf模型也是很简 ...

  6. Linux 文件夹和文件操作【Linux 常用命令系列一】

    〇.前言 本文首先介绍了 Linux 中文件的结构,将全部文件夹罗列并介绍了大概的用途: 然后通过实例介绍了文件夹相关的常用操作,仅供参考. 一.Linux 系统的文件结构 列一下系统全部文件夹: / ...

  7. git 怎么将某个开发分支最近几次的提交合并成一次提交

    1. 切换到开发分支: git checkout dev 2. 运行交互式 rebase 命令,并指定要合并的提交数量(在这个例子中是最近的3次提交): git rebase -i HEAD~3 3. ...

  8. tp5命名规范

    tp5中对类,文件名,函数和方法的命名规范如下: 类名和类文件名保持一致,并统一采用驼峰法命名(首字母大写) 类的命名采用驼峰法,并且首字母大写,例如 User.UserType,不需要添加contr ...

  9. 对比python学julia(第二章)--(第三节)玫瑰曲线—数学之美

    3.1.问题描述 在数学世界中有一些美丽的曲线图形,有螺旋线.摆线.双纽线.蔓叶线且.心脏线.渐开线.玫瑰曲线.蝴蝶曲线-- 这些形状各异.简有繁别的数学曲线图形为看似枯燥的数学公式披上精彩纷呈的美丽 ...

  10. 对比python学julia(第一章)--(第六节)数字黑洞

    6.1. 问题描述 6174数字黑洞是印度数学家卡普雷卡尔于1949年发现的,又称为卡普雷卡尔黑洞,其规则描述如下. 任意取一个4位的整数(4个数字不能完全相同),把4个数字由大到小排列成一个大的数, ...