错误提示:
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
运行
yum repolist all
0
查找帖子尝试:
yum -y install yum-utils
如果不能运行先试着更换yum源:
wget -O /etc/yum/repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum/repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
文件目录看好:
我的是在docker 容器了里遇到的,文件目录是:
/etc/yum/repos.d/
很快下载完成。
运行命令生成缓存
yum clean all
yum makecache
makecache 发现 404 无法访问
找到刚刚下载的 CentOS-Base.repo
发现访问地址:
http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
把变量$ r e l e a s e v e r releasever releasever改为7(我的系统是centos 7),发现可以访问了,顺便将所有的变量$releasever都改为7。
yum clean all
yum makecache
成功。