- 机器挂载光盘
无论是物理机还是虚拟机,首先要确定ISO光盘镜像已经挂载在系统挂载成功
[root@xxx yum.repos.d]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sr0 10717954 10717954 0 100% /mnt
mount -t auto /dev/sr0 /mnt
上述命令把光盘sr0挂载到/mnt目录下
- 编辑本地repo文件
Redhat 8的光盘包含2处Packages文件,在**/AppStream和/BaseOS**下都要写入yum源的配置文件中
[root@xxx yum.repos.d]# tree -d /mnt
/mnt
├── AppStream
│ ├── Packages
│ └── repodata
├── BaseOS
│ ├── Packages
│ └── repodata
├── EFI
│ └── BOOT
│ └── fonts
├── images
│ └── pxeboot
└── isolinux
12 directories
vi /etc/yum.repos.d/dvd.repo
[appstream]
name=appstream
baseurl=file:///mnt/AppStream/
gpgcheck=0
enabled=1
[baseos]
name=baseos
baseurl=file:///mnt/BaseOS/
gpgcheck=0
enabled=1
- 清理缓存,建立元数据
yum clean all
yum makecache
- 查看本地repo仓库
[root@xxx yum.repos.d]# yum repolist
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
仓库 id 仓库名称
appstream appstream
baseos baseos
这样就可以使用本地光盘作为yum源了。