1.创建一个目录
mkdir /mnt/cdrom
2.挂在镜像,每个镜像的名称可能不一样,需要进行 cd /dev/下查看对应的
mount /dev/cdrom /mnt/cdrom
3.进入到/etc/yum.repos.d/下 ,创建文件夹bak
mkdir bak
mv *.repo ./bak
cp CentOS-Media.repo ./
4.修改 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:///mnt/cdrom
gpgcheck=1
enabled=1
5. 检查yum源是否配置成功
yum makecache
6.清空yum缓存
yum clean all
7.查看yum 清单
yum list