Create Source
Mount the CD/DVD ROM on any directory of your wish. For testing, mount it on /cdrom.
#mkdir /cdrom
#mount /dev/cdrom /cdrom
Create Repo file
Before creating a repo file, move your existing repo files present in /etc/yum.repos.d directory, if not required.
#mv /etc/yum.repos.d/*.repo /tmp/
Create the new repo file called cdrom.repo under /etc/repos.d directory.
#vi /etc/yum.repos.d/local.repo
Add the following details.
[LocalRepo]
name=LocalRepository
baseurl=file:///cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Where,
[LocalRepo] = Repository Name which will be displayed during package installation
name = Name of the repository
baseurl = Location of the package
Enabled = Enable repository
gpgcheck = Enable secure installation
gpgkey = Location of the key
gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
Install Package from Local DVD YUM repository
Clear the repository cache by issuing the following command.
#yum clean all
Let’s install the vsftpd package from the local repository.
#yum install vsftpd