It’s common for system administrators to create their own repositories where they keep not only a copy of Red Hat (or CentOS) packages, but also their own custom software packages. Now I will guide you how to create a DVD repository from your CentOS DVD.
Step 1. You need to install the required package:
# yum install -y createrepo
Step 2. Create a repository in the temporary directory:
Step 3. You also need to clean the current repository cache:
# yum clean all
Step 4. Create a .repo file for your temporary repository:
Now when you use the yum command, you also query packages from the mounted DVD.
Have fun!