yum安装软件报错:Invalid configuration value: failovermethod=priority...

2023-05-16

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

错误一:

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-BaseOS.repo; Configuration: OptionBinding with id "failovermethod" does not exist
CentOS Linux 8 - AppStream                                                 6.3 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

当前环境为:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# uname -srm
Linux 4.18.0-348.2.1.el8_5.x86_64 x86_64

CentOS版本为:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 8.5.2111

解决办法:

1.找到CentOS相关目录,备份CentOS-AppStream,CentOS-Base文件,一般CentOS目录在/etc/yum.repos.d文件夹下,如下:

file

备份:

cp CentOS-Linux-AppStream.repo CentOS-Linux-AppStream.repo1
cp CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo1

2.编辑文件CentOS-Linux-AppStream.repo,CentOS-Linux-BaseOS.repo进行字符串替换:

vi CentOS-Linux-BaseOS.repo
# esc 键盘 : 命令模式下执行:
%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g 
# 继续执行:
%s/$releasever/$releasever-stream/g

vi CentOS-Linux-AppStream.repo
# esc 键盘 : 命令模式下执行:
%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g 
# 继续执行:
%s/$releasever/$releasever-stream/g

3.执行命令:

yum makecache
yum update

命令执行效果:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum update
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:01:22 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Error: 
 Problem: package centos-stream-release-8.6-1.el8.noarch requires centos-stream-repos, but none of the providers can be installed
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-2.el8.noarch
  - package centos-stream-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-3.el8.noarch
  - package centos-stream-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-4.el8.noarch
  - package centos-stream-repos-8-4.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - cannot install the best update candidate for package centos-linux-release-8.5-1.2111.el8.noarch
  - problem with installed package centos-linux-repos-8-3.el8.noarch
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

再次执行命令yum install expect,结果如下:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum install *expect*
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:07:00 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Package python3-pexpect-4.3.1-3.el8.noarch is already installed.
Dependencies resolved.
===========================================================================================================
 Package                       Architecture         Version                     Repository            Size
===========================================================================================================
Installing:
 expect                        x86_64               5.45.4-5.el8                baseos               267 k
 python3-aexpect               noarch               1.6.2-1.el8                 epel                  93 k
Installing dependencies:
 tcl                           x86_64               1:8.6.8-2.el8               baseos               1.1 M

Transaction Summary
===========================================================================================================
Install  3 Packages

Total download size: 1.5 M
Installed size: 5.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): python3-aexpect-1.6.2-1.el8.noarch.rpm                              467 kB/s |  93 kB     00:00    
(2/3): expect-5.45.4-5.el8.x86_64.rpm                                      282 kB/s | 267 kB     00:00    
(3/3): tcl-8.6.8-2.el8.x86_64.rpm                                          351 kB/s | 1.1 MB     00:03    
-----------------------------------------------------------------------------------------------------------
Total                                                                      461 kB/s | 1.5 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                   1/1 
  Installing       : tcl-1:8.6.8-2.el8.x86_64                                                          1/3 
  Running scriptlet: tcl-1:8.6.8-2.el8.x86_64                                                          1/3 
  Installing       : expect-5.45.4-5.el8.x86_64                                                        2/3 
  Installing       : python3-aexpect-1.6.2-1.el8.noarch                                                3/3 
  Running scriptlet: python3-aexpect-1.6.2-1.el8.noarch                                                3/3 
  Verifying        : expect-5.45.4-5.el8.x86_64                                                        1/3 
  Verifying        : tcl-1:8.6.8-2.el8.x86_64                                                          2/3 
  Verifying        : python3-aexpect-1.6.2-1.el8.noarch                                                3/3 

Installed:
  expect-5.45.4-5.el8.x86_64       python3-aexpect-1.6.2-1.el8.noarch       tcl-1:8.6.8-2.el8.x86_64      

Complete!

oK,可以进行yum安装啦.

注意:实际使用中如果没有 CentOS-AppStream.repo相关文件, 则不对其进行操作

eg:安装git:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum -y install git
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:07:51 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Dependencies resolved.
===========================================================================================================
 Package                      Architecture       Version                       Repository             Size
===========================================================================================================
Installing:
 git                          x86_64             2.31.1-2.el8                  appstream             161 k
Installing dependencies:
 git-core                     x86_64             2.31.1-2.el8                  appstream             4.7 M
 git-core-doc                 noarch             2.31.1-2.el8                  appstream             2.6 M
 perl-Error                   noarch             1:0.17025-2.el8               appstream              46 k
 perl-Git                     noarch             2.31.1-2.el8                  appstream              78 k
 perl-TermReadKey             x86_64             2.37-7.el8                    appstream              40 k

Transaction Summary
===========================================================================================================
Install  6 Packages

Total download size: 7.7 M
Installed size: 38 M
Downloading Packages:
(1/6): git-2.31.1-2.el8.x86_64.rpm                                         299 kB/s | 161 kB     00:00    
(2/6): perl-Error-0.17025-2.el8.noarch.rpm                                 185 kB/s |  46 kB     00:00    
(3/6): perl-Git-2.31.1-2.el8.noarch.rpm                                    290 kB/s |  78 kB     00:00    
(4/6): perl-TermReadKey-2.37-7.el8.x86_64.rpm                              148 kB/s |  40 kB     00:00    
(5/6): git-core-doc-2.31.1-2.el8.noarch.rpm                                385 kB/s | 2.6 MB     00:07    
(6/6): git-core-2.31.1-2.el8.x86_64.rpm                                    394 kB/s | 4.7 MB     00:12    
-----------------------------------------------------------------------------------------------------------
Total                                                                      640 kB/s | 7.7 MB     00:12     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                   1/1 
  Installing       : git-core-2.31.1-2.el8.x86_64                                                      1/6 
  Installing       : git-core-doc-2.31.1-2.el8.noarch                                                  2/6 
  Installing       : perl-TermReadKey-2.37-7.el8.x86_64                                                3/6 
  Installing       : perl-Error-1:0.17025-2.el8.noarch                                                 4/6 
  Installing       : perl-Git-2.31.1-2.el8.noarch                                                      5/6 
  Installing       : git-2.31.1-2.el8.x86_64                                                           6/6 
  Running scriptlet: git-2.31.1-2.el8.x86_64                                                           6/6 
  Verifying        : git-2.31.1-2.el8.x86_64                                                           1/6 
  Verifying        : git-core-2.31.1-2.el8.x86_64                                                      2/6 
  Verifying        : git-core-doc-2.31.1-2.el8.noarch                                                  3/6 
  Verifying        : perl-Error-1:0.17025-2.el8.noarch                                                 4/6 
  Verifying        : perl-Git-2.31.1-2.el8.noarch                                                      5/6 
  Verifying        : perl-TermReadKey-2.37-7.el8.x86_64                                                6/6 

Installed:
  git-2.31.1-2.el8.x86_64             git-core-2.31.1-2.el8.x86_64   git-core-doc-2.31.1-2.el8.noarch    
  perl-Error-1:0.17025-2.el8.noarch   perl-Git-2.31.1-2.el8.noarch   perl-TermReadKey-2.37-7.el8.x86_64  

Complete!
[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# git --version
git version 2.31.1

错误二:

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Repository extras is listed more than once in the configuration
CentOS Linux 8 - AppStream                                                 6.7 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: xxx.xxx.xxx.xxx)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

解决方法

进入文件 /etc/yum.repos.d/CentOS-Epel.repo,将 failovermethod=priority 注释:

file

ok, 这样也可以进行yum安装

错误三:

Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: xxx.xxx.xxx.xxx)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

这个错误的意思是: 为仓库 'base' 下载元数据失败

那么我们就要考虑是不是yum源的问题了,因为上面说了,我们的系统是CentOS Linux release 8.5.2111版本的,而CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本

背景信息

2021年12月31日CentOS 8 EOL。按照社区规则,CentOS 8的源地址http://mirror.centos.org/centos/8/内容已移除,目前第三方的镜像站中均已移除CentOS 8的源。阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也无法同步到CentOS 8的源。当您在阿里云上继续使用默认配置的CentOS 8的源会发生报错。报错示例如下图所示:

file

您可以通过下文的操作步骤,在CentOS 8操作系统的ECS实例中将源配置按照网络环境不同进行切换。

yum源:专有网络VPC类型实例需切换为http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111源。

epel源:专有网络VPC类型实例需切换为http://mirrors.cloud.aliyuncs.com/epel-archive/8/源

官方操作布置,如下:

1.登录CentOS 8系统的ECS实例

2.运行以下命令备份之前的repo文件。

rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

3.运行以下命令下载最新的repo文件。

wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo

4.运行以下命令替换repo文件中的链接。

sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g'  /etc/yum.repos.d/Centos-vault-8.5.2111.repo &&  sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo

5.运行以下命令重新创建缓存。

yum clean all && yum makecache

yum源和epel源切换完成后,即可使用yum install命令在实例上安装您所需要的软件包

跟着官方的步骤走下去,最后如果有报错,下面是正确解决流程:

1.进入/etc/yum.d.repos.d/,运行以下命令备份之前的repo文件

rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo

2.运行以下命令下载最新的repo文件:

wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo

3.运行以下命令替换repo文件中的链接,这一步出错了,官方提供的命令:

sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo

http://mirrors.cloud.aliyuncs.com 需要替换为http://mirrors.aliyun.com ,但是官方提供的命令没替换完,如果有执行官方提供的命令还是不行的话执行下面的命令:

sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/epel-archive-8.repo

运行以下命令重新创建缓存

yum clean all && yum makecache

执行成果,yum install也就可以正常使用了~

本文转自:https://blog.csdn.net/zhoupenghui168/article/details/123370719

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

yum安装软件报错:Invalid configuration value: failovermethod=priority... 的相关文章

  • commonjs模块和es6模块的区别

    es6模块在浏览器端和服务器端都可用 xff0c commonjs只适用于服务端 1 xff0c es6是编译时输出接口 xff08 接口在代码在解析阶段就已经生成 xff09 xff0c commonjs是运行时加载 xff0c 在脚本完
  • uboot的命令体系-2.8.uboot源码分析4-朱有鹏-专题视频课程

    uboot的命令体系 2 8 uboot源码分析4 3793人已学习 课程介绍 本课程为uboot学习的第8部分 xff0c 主要讲解uboot的命令体系 分析了uboot的命令定义和实现的方法 xff0c 教大家自己向uboot中添加自定
  • 浪潮服务器忘记管理口地址,远程配置raid,远程安装系统。

    如果浪潮服务器忘记了管理口地址 xff0c 可以通过设置临时IP地址进行服务器管理 xff08 必须保证服务器之前IPV4的获取方式为DHCP xff09 使用工具 xff1a tftpd32 xff08 网上可直接搜索下载 xff09 x
  • linux命令行——linux快速搜索历史命令

    一 需求描述 在执行命令时 xff0c 对于已经输入的历史命令 xff0c 可以通过关上下键进行翻找 xff0c 如果是最近几条 xff0c 很容易找到 xff0c 如果是很久之前的命令 xff0c 依旧使用上下键查找就会力不从心 二 解决
  • 如何用六步教会你使用python爬虫爬取数据

    前言 xff1a 用python的爬虫爬取数据真的很简单 xff0c 只要掌握这六步就好 xff0c 也不复杂 以前还以为爬虫很难 xff0c 结果一上手 xff0c 从初学到把东西爬下来 xff0c 一个小时都不到就解决了 python爬
  • react实现点击复制

    1 使用浏览器提供的document execCommand 39 copy 39 2 使用copy to clipboard库 document execCommand 34 copy 34 1 document execCommand封
  • zustand

    最近工作中需要用到zustand xff0c 先记录一下学到的demo 安装 xff1a npm install zustand 公共文件store引入 import create from 39 zustand 39 const useS
  • antd获取表单的所有数据

    当我们使用antd的组件的form 表单时 xff0c 数据一般在form中的onFinish 61 onFinish 方法上可以拿到 const Demo 61 61 gt const onFinish 61 values any 61
  • antd使用阿里巴巴矢量图标

    最近需要在antd引入中阿里矢量图标 xff0c 看到几个关于antd使用iconfont的回答 xff0c 其中关于Icon的引入 xff0c 都是写的从antd引入 xff08 不可用 xff09 旧版本 xff1a import Ic
  • antd表单赋值,回显表格数据

    使用 antd 做表格回显数据时 xff0c 会看到文档有写 xff1a 所以我们可以 1 定义hooks const form 61 Form useForm 2 在触发事件中使用 xff0c 以打开模态框赋值为例 const showM
  • react反向代理配置

    官网 xff1a https create react app dev docs proxying api requests in development 安装 npm install http proxy middleware save
  • js立即执行函数写法

    优点 xff1a 1 立即执行 xff0c 不用担心临时变量污染全局变量 xff0c 减少命名 2 方便封装 写法 xff1a function name params console log params 打印 1 1 function
  • uboot的环境变量-2.9.uboot源码分析5-朱有鹏-专题视频课程

    uboot的环境变量 2 9 uboot源码分析5 3347人已学习 课程介绍 本课程为uboot学习的第9部分 xff0c 主要讲解uboot的环境变量的实现原理和环境变量在内存中 SD卡中的存储方法 结合环境变量相关的几个命令的代码分析
  • 输出什么呢?

    let normaLize 61 function params let arr 61 params split g filter v 61 gt v let result 61 let obj 61 result while key 61
  • Pormise

    Promise是一个构造函数 三种状态 xff1a pending xff08 进行中 xff09 fulfilled xff08 已成功 xff09 和rejected xff08 已失败 xff09 xff0c fulfilled和re
  • js删除对象的某个属性

    第一种 xff1a delete const obj 61 name 39 章三 39 age 18 删除age这个属性 delete obj age console log obj name 39 章三 39 第二种 xff08 ES6
  • moment时区转换

    moment js 时区转换 根据本地时区 moment 34 2022 05 31T16 00 00 000Z 34 format 39 YYYY MM DD 39 39 2022 06 01 39
  • TypeScript

    安装 npm install g typescript 安装完成后 xff0c 在控制台运行如下命令 xff0c 检查安装是否成功 3 x xff1a tsc V vscode自动编译 1 生成配置文件tsconfig json tsc i
  • 数组中第一个不重复的值

    var firstUniqChar 61 function s const arr 61 countBy s for const i k of Array from s entries if arr k 61 61 61 1 return
  • JS中数组转字符串,字符串转数组方法合集

    一 字符串转数组 xff1a 1 Array split const str 61 39 hello 39 str split 39 39 39 h 39 39 e 39 39 l 39 39 l 39 39 o 39 const str2

随机推荐