首先是需要你把需要使用的镜像挂载到系统上面,可以通过cd /dvd添加也可以直接上传到系统上
本文档是上传到系统上进行挂载
操作系统:Red Hat 7.6
挂载镜像:Red Hat 7.6
1.挂载镜像
mount /tmp/rhel-server-7.6-x86_64-dvd.iso /mnt/
2.配置yum文件
先使用yum install telnet 看是否会提醒以下问题
[root@localhost ~]# yum install telnet Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process No package telnet available. Error: Nothing to do [root@localhost ~]#
如果有以上问题请使用
yum remove subscription-manager
配置yum源
vim /etc/yum.repos.d/redhat.repo #添加一下内容,注意挂载镜像路径 [local] name=Red Hat Enterprise Linux 7.7 baseurl=file:///mnt enabled=1 gpgcheck=1 gpgkey=file:///mnt/RPM-GPG-KEY-redhat-release
使用一下清除yum缓存
yum clean all
这就配置成功了,可以进行yum测试