1、创建光盘挂载的目录,系统默认/mnt/目录下
[root@redhat ~]# mkdir /guangpan
2、将光盘挂载到创建的目录下
[root@redhat ~]# mount /dev/sr0 /guangpan/
3、编辑本地yum源文件
[root@redhat ~]# vim /etc/yum.repos.d/base.repo [baseos]
name=baseos
baseurl=file:///guangpan/BaseOS
gpgcheck=0
[base]
name=base
baseurl=file:///guangpan/AppStream
gpgcheck=0
4、列出可用的仓库状态
[root@redhat ~]# yum repolist
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.
Repository base is listed more than once in the configuration
baseos 19 MB/s | 2.2 MB 00:00
上次元数据过期检查:0:00:01 前,执行于 2020年11月16日 星期一 22时40分33秒。
仓库标识 仓库名称 状态
AppStream CentOS-8 - AppStream - mirrors.aliyun.com 4,933
base CentOS-8 - Base - mirrors.aliyun.com 1,673
baseos baseos 1,661
extras CentOS-8 - Extras - mirrors.aliyun.com 3
5、测试
[root@redhat ~]# yum install -y httpd
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.
Repository base is listed more than once in the configuration
上次元数据过期检查:0:05:43 前,执行于 2020年11月16日 星期一 22时40分33秒。
软件包 httpd-2.4.37-21.module_el8.2.0+494+1df74eae.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
6、删除软件包
[root@redhat ~]# yum remove -y httpd