CentOS

Use DVD as Local Repository in CentOS

Appstream (Application Stream) and BaseOS are the two repositories that ship with CentOS 8. Centos 8 has two repositories, and they are different from one another. Among AppStream’s components are software packages such as databases and dependencies. BaseOS repository provides requisite packages, which are useful for an operating system that is minimal. If you also want to use DVD as a Local repository, then go through this article because we have written everything regarding CentOS use DVD as local repo.

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.

# mount CentOS-8-x86_64-1905-dvd1.iso /opt

# 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.

# cp -v /opt/media.repo /etc/yum.repos.d/centos8.repo

Secondly, it is necessary to assign the proper permissions to the file in order to prevent another user from modifying or changing it.

# chmod 644 /etc/yum.repos.d/centos8.repo

# 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.

# cat etc/yum.repos.d/centos8.repo

With the help of a text editor, we modify the configuration lines according to our preferences.

# vim etc/yum.repos.d/centos8.repo

After deleting all the current configurations, copy and paste the following configurations.

[InstallMedia-BaseOS]

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.

# dnf clean all

OR

# yum clean all

Next, we run a command to determine if the system is receiving packages from the locally defined repositories.

# dnf repolist

OR

# yum repolist

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.

# dnf install nodejs

OR

# yum install nodejs

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.

About the author

Ankit Sharma