Step 1: First of all, we will mount the ISO file in the directory according to our choice. In this process, we have mentioned the on / opt directory.
# cd /opt
# ls
Step 2: A mounted directory contains our ISO. Make sure that the Media.repo file is in the /etc/yum.repos.d/ directory.
Secondly, it is necessary to assign the proper permissions to the file in order to prevent another user from modifying or changing it.
# ls -l /etc/yum.repos.d/centos8.repo
The cat command checks the configuration of the default repository file on the system. The configuration of it is also essential.
With the help of a text editor, we modify the configuration lines according to our preferences.
After deleting all the current configurations, copy and paste the following configurations.
name=CentOS Linux 8 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///opt/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[InstallMedia-AppStream]
name=CentOS Linux 8 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///opt/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Extracted from the editor and saved as a repo file. Following the modification of the repository file, it is a good idea to clear the YUM/DNF cache.
OR
Next, we run a command to determine if the system is receiving packages from the locally defined repositories.
OR
The ‘enable’ parameter has been set to zero in the CentOS repositories; CentOS-Base.repo and AppStream.repo files.
Step 3: Install packages via local Yum or DNF repositories, and we can install any package in this step.
OR
Our last step is to confirm that a local DNF/YUM repository has been installed successfully on CentOS 8.
Conclusion
Using a CentOS 8 installation DVD, we will be able to set up a DNF or YUM repository locally. We have an official website called Linuxhint that will give you more information about Linux. We have explained the possible way to use DVD as repo in CentOS 8.