docker作为虚拟机来测试linux命令

安装vim

yum -y install vim

报错如下

Error: Failed to download metadata for repo ‘appstream‘: 
Cannot prepare internal mirrorlist

解决方式:

将镜像从 mirror.centos.org 更改为 vault.centos.org

# 进入目录
cd /etc/yum.repos.d/

# 修改镜像
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 makecache

yum update -y

现在可以正常安装vim了

yum -y install vim

参考 已解决】Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist