Error: Failed to download metadata for repo 'appstream' : Cannot prepare internal mirrorlist: No URLs in mirrorlist
时间: 2023-11-13 16:52:21 浏览: 133
根据提供的引用内容,错误信息"Error: Failed to download metadata for repo 'appstream' : Cannot prepare internal mirrorlist: No URLs in mirrorlist"是由于CentOS 8停止服务导致的。解决此问题的方法是修改yum源配置文件。请按照以下步骤操作:
1. 进入"/etc/yum.repos.d/"目录:
```
cd /etc/yum.repos.d
```
2. 修改配置文件,注释掉所有以"mirrorlist"开头的行:
```
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
```
3. 将所有以"baseurl"开头的行的注释符"#"去掉,并将地址修改为阿里源的地址:
```
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
```
4. 如果尚未安装wget,请先安装wget:
```
yum install wget -y
```
5. 更新yum源为阿里源:
```
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
```
6. 清除所有缓存并重新生成:
```
yum clean all
yum makecache
```
7. 验证修复是否成功,例如安装vim:
```
yum install -y vim
```
以上步骤可解决"Error: Failed to download metadata for repo 'appstream' : Cannot prepare internal mirrorlist: No URLs in mirrorlist"的问题。
阅读全文