Configure CDROM as local YUM in CentOS 7
By default, CentOS7 does not have any yum source. In this example, mount a local DVD to/mnt/cdrom and connect the system yum source to/mnt/cdrom.
# Use yum-config-manager to generate a source file template
[Root @ server0 yum. repos. d] #Yum-config-manager -- add-repo = cdrom
Loaded plugins: langpacks, product-id
Adding repo from: cdrom
[Cdrom]
Name = added from: cdrom
Baseurl = cdrom
Enabled = 1
# Edit the generated template as follows:
[Root @ server0 yum. repos. d] # cat cdrom. repo
[Cdrom]
Name = DVD Media
Baseurl = file: // mnt/cdrom
Enabled = 1
# Attaching CDROM
[Root @ server0 yum. repos. d] #Mount/dev/cdrom/mnt/cdrom/
Mount:/dev/sr0 is write-protected, mounting read-only
# Import RPM-GPG-KEY
[Root @ server0 yum. repos. d] #Rpm -- import/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-xxxx
# View
[Root @ server0 ~] #Yum repolist
Loaded plugins: langpacks, product-id, submodules-manager
This system is not registered to Red Hat sub‑management. You can use sub‑manager to register.
Repo id repo name status
Cdrom, DVD Media 4,305
Repolist: 4,305