How do I mount the CentOS 7 ISO and add it as a yum repository

activedecay asked:

How do I mount the CentOS 7 ISO and add it as a yum repository?

The places I search say to look for a media.repo underneath the mounted ISO, but there is no such file.

My answer:

The repo file is already present on your installed CentOS system, as /etc/yum.repos.d/CentOS-Media.repo.

[[email protected] ~]# cat /etc/yum.repos.d/CentOS-Media.repo 
# CentOS-Media.repo
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
# or for ONLY the media repo, do this:
#  yum --disablerepo=\* --enablerepo=c7-media [command]

name=CentOS-$releasever - Media

Mount the ISO image at one of the given locations, or modify the file appropriately, then enable it as instructed.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.