Centos8使用yum出现无法访问的错误

星期一, 2020-02-03 | Author: Lee | JAVA-and-J2EE, linux | 11,967 views

1.服务器升级系统到centos8,发现无法使用yum update

错误为:Failed to synchronize cache for repo ‘AppStream’, ignoring this repo.

2.修复之法:

2.1:检测网络是否通畅

2.2:修改 baseurl 的地址 http://mirrors.cloud.aliyuncs.com(在另外一台机器上好用,这台怎么都ping不通)

替换成http://mirrors.aliyun.com

即可,这两个地址可以尝试下哪个好用,把/etc/yum.repos.d/下的.repo文件都替换下,主要是下面三个

/etc/yum.repos.d/CentOS-AppStream.repo
/etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/CentOS-Extras.repo

替换:
vi /etc/yum.repos.d/CentOS-Base.repo

[BaseOS]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

vi /etc/yum.repos.d/CentOS-AppStream.repo

[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://mirrors.aliyun.com/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

3.修改完之后执行 dnf命令或者yum 命令都可以

dnf clean all # 清除所有的缓存文件

dnf makecache # 制作元数据缓存

Tags: ,

文章作者: Lee

本文地址: https://www.pomelolee.com/2017.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta