Redhat8&CentOS8的yum源配置

Redhat8&CentOS8的yum源配置

1.配置/etc/yum.reop.d/xxx.repo
vi xxx.repo
[server]
name=server
baseurl=file:///mnt
gpgcheck=0
enabled=1
2.挂载iso文件
mount xxxx.iso /mnt
3.yum源刷新
yum clean all
yum makecache

想必很多小伙伴都是按照以上的操作去配置yum源。那可能就会有如下报错:
【Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rh8 0.0 B/s | 0 B 00:00
Errors during downloading metadata for repository ‘rh8’:
Curl error (37): Couldn’t read a file:// file for file:///mnt/repodata/repomd.xml [Couldn’t open file /mnt/repodata/repomd.xml]
Error: Failed to download metadata for repo ‘rh8’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried】

研究了半天,终于知道了8的配置方法。
以下为正确的配置方法:
1.配置/etc/yum.reop.d/xxx.repo
vi xxx.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
enabled=1
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
enabled=1
2.挂载iso文件
mount xxxx.iso /mnt
3.yum源刷新
yum clean all
yum makecache

这就ok了。那原因是什么呢? 原来在8的iso文件里面,没有了repodata/这个目录。例如我iso挂载到/mnt下,那就没有/mnt/repodata/这个目录。取而代之的是/mnt/BaseOS/repodata/和/mnt/AppStream/repodata/ 这两个目录。因此,我们在配置repo文件的时候要比7和7以前的多配置一串东东。
好啦,结束,每天一点小知识,今天你get了吗?

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值