首先确定你的网卡是启动的,重启命令:
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)