How to set up yum repository to use locally-mounted DVD with Red Hat Enterprise Linux (RHEL/OEL/Centos)
SOLUTION

Mount an installation ISO file and set up YUM Repository Configuration File

DEMO

Copy an installation ISO file to your server. For instance, Oracle Linux Release 7 Update 3 for x86 (64 Bit)

[root@dbpilot ~] pwd
/oracle/iso

[root@dbpilot ~] ls -lthr --time-style='+'
total 4.4G
-rw-r--r--. 1 root root 4.4G  V834394-01.iso

Create a new directory or use an existing one to mount ISO image

####################
## Mounting the ISO image to /mnt
####################

[root@dbpilot ~] mount -t iso9660 -o loop /oracle/iso/V834394-01.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only

####################
## Listing content of the  ISO image 
####################

[root@dbpilot ~] cd /mnt
[root@dbpilot ~] ls -lthr --time-style='+'
total 1.1M
drwxr-xr-x. 5 root root 2.0K  addons
-rw-r--r--. 1 root root 1011  RPM-GPG-KEY-oracle
-rw-r--r--. 1 root root 1011  RPM-GPG-KEY
-rw-r--r--. 1 root root 183K  RELEASE-NOTES-U3-en.html
-rw-r--r--. 1 root root  63K  RELEASE-NOTES-U3-en
-rw-r--r--. 1 root root  18K  GPL
-rw-r--r--. 1 root root 8.5K  EULA
drwxr-xr-x. 2 root root 758K  Packages
drwxr-xr-x. 2 root root 4.0K  repodata
drwxr-xr-x. 2 root root 2.0K  LiveOS
drwxr-xr-x. 3 root root 2.0K  EFI
drwxr-xr-x. 3 root root 2.0K  images
-r--r--r--. 1 root root 3.3K  TRANS.TBL
drwxr-xr-x. 2 root root 2.0K  isolinux

Create a repository file. The name of a file can be anything you want, but it should end with .repo. For instance, the iso.repo.

[root@dbpilot ~] touch /etc/yum.repos.d/iso.repo

Place the following configuration into the created .repo file

[ISO_REPOSITORY]
name=V834394-01.iso local repository
baseurl=file:///mnt
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=1
enabled=1
NOTE

For details about repository parameters refer to man pages

[root@dbpilot ~] man yum.conf

The YUM repository is ready for use

####################
## Cleaning YUM cache
####################

[root@dbpilot ~] yum clean all
Loaded plugins: ulninfo
Cleaning repos: ISO_REPOSITORY
Cleaning up everything

####################
## Searching for a package 
####################

[root@dbpilot ~] yum search vim
Loaded plugins: ulninfo
ISO_REPOSITORY                                                                    | 3.6 kB  00:00:00
(1/2): ISO_REPOSITORY/group_gz                                                    | 134 kB  00:00:00
(2/2): ISO_REPOSITORY/primary_db                                                  | 4.5 MB  00:00:00
=========================================== N/S matched: vim ============================================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor

  Name and summary matches only, use "search all" for everything.

####################
## Displaying information about a package
####################

[root@dbpilot ~] yum info vim-X11.x86_64
Loaded plugins: ulninfo
Available Packages
Name        : vim-X11
Arch        : x86_64
Epoch       : 2
Version     : 7.4.160
Release     : 1.el7
Size        : 1.1 M
Repo        : ISO_REPOSITORY
Summary     : The VIM version of the vi editor for the X Window System
URL         : http://www.vim.org/
License     : Vim
Description : VIM (VIsual editor iMproved) is an updated and improved version of the
            : vi editor.  Vi was the first real screen-based editor for UNIX, and is
            : still very popular.  VIM improves on vi by adding new features:
            : multiple windows, multi-level undo, block highlighting and
            : more. VIM-X11 is a version of the VIM editor which will run within the
            : X Window System.  If you install this package, you can run VIM as an X
            : application with a full GUI interface and mouse support.
            :
            : Install the vim-X11 package if you'd like to try out a version of vi
            : with graphics and mouse capabilities.  You'll also need to install the
            : vim-common package.

Written At
05 FEB 201813:30
Red Hat Release
5.x-7.x x64