CentOS8更换yum数据源,解决yum update报错问题

zhuanbike 2021-11-11 1239

首先确定你的网卡是启动的,重启命令:

nmcli c reload


清理旧的数据源:

rm -rf /etc/yum.repos.d/*

换上阿里云的数据源:

wget -O /etc/yum.repos.d/CentOS-aliyun.repo http://mirrors.aliyun.com/repo/Centos-8.rep

#  7的版本
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

然后安装EPEL

yum install epel-release
yum update -y

解决提示错误:

yum                                                                          0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'yum':
  - Curl error (37): Couldn't read a file:// file for file:///mnt/AppStream/repodata/repomd.xml [Couldn't open file /mnt/AppStream/repodata/repomd.xml]
Error: Failed to download metadata for repo 'yum': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried


但是8的版本还是有点问题:yum update会报这样的错误。

Error: 
 Problem 1: cannot install both httpd-filesystem-2.4.37-39.module_el8.4.0+950+0577e6ac.1.noarch and httpd-filesystem-2.4.37-30.module_el8.3.0+561+97fdbbcc.noarch
  - package httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 requires httpd-filesystem = 2.4.37-30.module_el8.3.0+561+97fdbbcc, but none of the providers can be installed
  - cannot install the best update candidate for package httpd-filesystem-2.4.37-30.module_el8.3.0+561+97fdbbcc.noarch
  - problem with installed package httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64
 Problem 2: package httpd-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64 requires httpd-tools = 2.4.37-30.module_el8.3.0+561+97fdbbcc, but none of the providers can be installed
  - cannot install both httpd-tools-2.4.37-39.module_el8.4.0+950+0577e6ac.1.x86_64 and httpd-tools-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64
  - package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 requires httpd-mmn = 20120211x8664, but none of the providers can be installed
  - cannot install the best update candidate for package httpd-tools-2.4.37-30.module_el8.3.0+561+97fdbbcc.x86_64
  - problem with installed package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64
  - package httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64 is filtered out by exclude filtering
  - package httpd-2.4.37-39.module_el8.4.0+950+0577e6ac.1.x86_64 is filtered out by exclude filtering
(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)


最新回复 (7)
  • zhuanbike 2021-11-11
    0 引用 2
    CentOS已经不在更新了。
  • zhuanbike 2021-11-11
    0 引用 3

    查看当前centOS版本  cat  /etc/redhat-release
  • zhuanbike 2021-11-11
    0 引用 4
    Skipping packages with conflicts:
    (add '--best --allowerasing' to command line to force their upgrade):
     httpd-filesystem        noarch        2.4.37-39.module_el8.4.0+950+0577e6ac.1        appstream         39 k
     httpd-tools             x86_64        2.4.37-39.module_el8.4.0+950+0577e6ac.1        appstream        106 k

    Transaction Summary
  • zhuanbike 2021-11-11
    0 引用 5
    yum update --nobest 
  • zhuanbike 2021-11-12
    0 引用 6
    对于那个httpd报错,大概率是版本依赖问题,可以卸载重装。
    https://blog.csdn.net/Yan_MF/article/details/90452487
  • zhuanbike 2021-11-12
    0 引用 7
    yum update --allowerasing
    也可以用这个命令直接替换
  • zhuanbike 2021-11-12
    0 引用 8
    强制卸载 apache 
    rpm -e httpd --nodeps
发新帖