How to create a local repository in RHEL 8 from DVD ISO

mkdir /media/rhel8/

mount -o loop rhel-8.2-x86_64-dvd.iso /media/rhel8/

cp /media/rhel8/media.repo /etc/yum.repos.d/

chmod 644 /etc/yum.repos.d/media.repo

vi /etc/yum.repos.d/media.repo

[InstallMedia]
name=Red Hat Enterprise Linux 8.2.0
mediaid=None
metadata_expire=-1
gpgcheck=0
cost=500
baseurl=file:///media/rhel8/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[InstallMedia-AppStream]
name=Red Hat Enterprise Linux 8 – AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///media/rhel8/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release