Note: Installing Packages on CentOS from an ISO Image

Published on

Original language: Chinese . AI translations: English , Japanese .


Issues I ran into while setting an ISO image as a local repo.

Reference Tutorial

Install packages in CentOS from DVD without connection to internet
Very detailed, clear steps.

But I hit one issue, so I’m noting it down.

baseurl Setting

From the reference, I thought baseurl in /etc/yum.repos.d/CentOS-Media.repo was an array, and mounting the ISO to any one of the directories would work.
But in fact baseurl only accepts a single value. Just set it to the mount directory.

Before fixing this, yum threw curl error / failed to download metadata from file:///........(a long path) because it treated the three default paths as one.

CentOS 8 ISO Has Two Repos: BaseOS & AppStream

This isn’t really a problem, since /etc/yum.repos.d/CentOS-Media.repo also provides two entries.

Extra

You can disable other repos so yum doesn’t need --disablerepo / --enablerepo flags.

More References

How to Set Up a Local Yum/DNF Repository on CentOS 8
Need to set up yum repository for locally-mounted DVD on Red Hat Enterprise Linux 7