一。
点击创建的Rhel9.0,选择设置,选择CD/DVD,确保设备状态如图显示,然后save and exit,重启Guest Os。
二。
运用命令lsblk,检查iso挂载
[root@192 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 7.9G 0 rom /run/media/root/RHEL-9-0-0-BaseOS-x86_64
nvme0n1 259:0 0 40G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /boot
└─nvme0n1p2 259:2 0 39G 0 part
├─rhel_192-root
│ 253:0 0 35.1G 0 lvm /
└─rhel_192-swap
253:1 0 3.9G 0 lvm [SWAP]
三。
从上图显示iso已经mount到/media/下,现在我们需要将里面的media.repo负责到/etc/yum.repos.d/下
[root@192 /]# cd media/
[root@192 media]# ls
AppStream EULA images RPM-GPG-KEY-redhat-beta
BaseOS extra_files.json isolinux RPM-GPG-KEY-redhat-release
EFI GPL media.repo
[root@192 media]# cd /etc/yum
yum/ yum.repos.d/
[root@192 media]# cd /etc/yum.repos.d/
[root@192 yum.repos.d]# ls
redhat.repo
[root@192 yum.repos.d]# cp /media/media.repo ./
[root@192 yum.repos.d]# ls
media.repo redhat.repo
四。
然后使用vim配置media.repo文件,然后按ESC。输入:wq保存完成编写,且完成本地源的配置
[BaseOS]
name=BaseOS
baseurl=file:///media/BaseOS #指定yum源所在文件,软件包的所在文件
gpgcheck=0
enabled=1
[AppStream]
name=AppStream
baseurl=file:///media/AppStream #指定yum源所在文件,软件包的所在文件
enabled=1
gpgcheck=0
五。
加载本地yum源&测试
# 清除yum缓存
yum clean all
# 缓存本地yum源
yum makecache
# 查看是否成功
yum repolist
六。
[root@192 yum.repos.d]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
repo id repo name
AppStream AppStream
BaseOS BaseOS
[root@192 yum.repos.d]# yum install ndctl*
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
BaseOS 130 MB/s | 1.7 MB 00:00
AppStream 160 MB/s | 5.8 MB 00:00
Package ndctl-libs-71.1-6.el9.x86_64 is already installed.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
ndctl x86_64 71.1-6.el9 BaseOS 193 k
ndctl-devel x86_64 71.1-6.el9 AppStream 29 k
Transaction Summary
================================================================================
Install 2 Packages
Total size: 222 k
Installed size: 412 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check