Centos7

如何掛載 CentOS 7 ISO 並將其添加為 yum 儲存庫

  • December 5, 2021

如何掛載 CentOS 7 ISO 並將其添加為 yum 儲存庫?

我搜尋的地方說要在安裝的 ISO 下尋找一個media.repo,但沒有這樣的文件。

repo 文件已經存在於您安裝的 CentOS 系統上,如/etc/yum.repos.d/CentOS-Media.repo.

[root@localhost ~]# 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]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
       file:///media/cdrom/
       file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

將 ISO 映像掛載到給定位置之一,或適當修改文件,然後按照說明啟用它。

引用自:https://serverfault.com/questions/939406