Request: Configure YUM to use the OS install disk as a repo

My good friend Tony asked for a quick HowTo detailing the steps for setting up YUM to use the RHEL/CentOS/Fedora installation disk as a repository. The OS installation disk contains packages that may not have been installed during initial setup that may be needed at a later time.

  1. Insert the OS installation disk into the optical drive. If the target system is virtual, make the installation disk image (.iso) available to the virtual machine via the hypervisor.
    • OPTIONAL: If the target system is using autofs and autofs is configured to automatically mount optical disks upon insertion we’ll want to unmount the installation disk by running the following from a root prompt:
      • # umount /dev/sr0
  2. Configure the repository. YUM searches repositories listed in /etc/yum.conf and in /etc/yum.repos.d when YUM commands are ran. The most scalable solution is to create a new .repo file in /etc/yum.repos.d for your installation disk. A .repo file requires only 3 things to be valid: A repoid enclosed in square brackets, a friendly name for the repo appearing after the name= directive, and a URI giving a location for the repo after the baseurl= directive. The following steps will create a .repo file suitable for serving the installation disk from the optical drive:
    1. From a root prompt type: vi /etc/yum.repos.d/installdisk.repo
    2. Press i to enter insert mode and paste in the following:
[installdisk]
name=installdisk
baseurl=file:///installdisk

3. Press <esc> to leave vi’s insert mode and save the file with :wq

  1. Mount the disk under /installdisk by typing the following at a root prompt (create /installdisk with mkdir if it doesn’t already exist):
    • # mount /dev/sr0 /installdisk
  2. Confirm the installdisk repo is visible to yum with the following command:
    • # yum repolist
    • You should see installdisk among the repositories visible to YUM, and if you’re on RHEL/CentOS7 you should see a number indicating the number of packages available in that repository. On the installation disk for CentOS Linux release 7.8.2003 I get 4,021 available packages.

Troubleshooting:

This is a fine ad hoc solution for installing a couple of packages from the installation disk. Notice that for speed we didn’t install the gpg key that comes with the installation disk. For this reason you might receive a failed gpgcheck error when attempting to install packages from this repository. In order to get around this add the gpgcheck=0 directive to /etc/yum.repos.d/installdisk.repo file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.