一、Centos8停止更新后,使用yum安装报如下错误:
1 2 3 4 5 |
[root@ce5d8a78a3b5 /]# yum install -y epel-release Failed to set locale, defaulting to C.UTF-8 CentOS Linux 8 - AppStream 78 B/s | 38 B 00:00 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist |
二、解决方法
1 |
cd /etc/yum.repos.d/ |
- 进入yum的repo存储库目录
1 |
cd /etc/yum.repos.d/ |
- 修改所有的CentOS文件内容
1 2 3 |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* |
- 更新yum源为阿里镜像
1 2 3 4 5 |
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo yum clean all yum makecache |
- yum安装测试是否可以yum安装
1 |
yum install wget –y |