CentOS7之执行yum命令报错

Posted Owen_ET

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7之执行yum命令报错相关的知识,希望对你有一定的参考价值。

备份文件:

# 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命令报错的主要内容,如果未能解决你的问题,请参考以下文章

centos7,yum安装工具报错

为centos7配置阿里yum源遇到的问题以及解决方法

执行yum 命令出错

执行yum 命令出错

新装centos7,没有ifconfig命令

解决YUM报错except KeyboardInterrupt,