Run "yum repolist all" to see the repos you have

错误提示:

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

成功。

  • 12
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值