主机评测 - yum
type: channel
link: https://zjpc.cc/tag/yum/
items: 解决Centos无法yum问题
items: yum记事

解决Centos无法yum问题
type: item
date: 2024-07-24T13:43:51+08:00
description: 近期陆续有很多网友反映CentOS在进行yum操作时，会出现Mirrorlist镜像源报错的问题。Loaded plugins: fastestmirror Determining fastest mirrors 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; Unknown error"缘由是由于CentOS 7、8 和 Stream 8 已停止更新，官方已将原本的镜像列表（Mirrorlist）下架并归档，导致原始链接无法再访问原来的镜像源。以下为最简单的解决方式直接执行以下两行命令：sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*清理YUM缓存并生成新缓存（可选）：sudo yum clean all sudo yum makecache更新系统：sudo yum update解释：sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*这条命令使用sed编辑器将所有/etc/yum.repos.d/CentOS-*文件中的mirrorlist行注释掉。sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*这条命令将所有/etc/yum.repos.d/CentOS-*文件中被注释掉的baseurl行改为指向vault.centos.org，并取消注释。当然，对Mirrorlist/SourcesList 比较了解的MJJ，可以自行更改为其他的源。如果您希望了解更多关于Linux镜像源配置的内容，我们推荐访问以下网址：https://help.mirrorz.org/。 该网站提供了丰富且详细的资源信息，能够帮助您更好地管理和配置Linux系统。

yum记事
type: item
date: 2022-03-27T18:10:47+08:00
description: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum makecache yum install yum-utils -y yum install yum-plugin-fastestmirror.noarch -y yum grouplist | more yum groupinstall -y "Development Tools" yum install net-tools wget psmisc strace -y yum repolist all https://dev.mysql.com/downloads/repo/yum/ wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm rpm -Uvh mysql80-community-release-el7-3.noarch.rpm yum-config-manager –-disable mysql80-community yum-config-manager –-enable mysql57-community yum install mysql-community-server