挂载光驱
mount -t auto /dev/cdrom /mnt
配置本地源
[root@gbasempp1 yum.repos.d]# cat 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/
 gpgcheck=0
 enabled=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@gbasempp1 yum.repos.d]# yum clean all
 Loaded plugins: fastestmirror
 Cleaning repos: c7-media
 [root@gbasempp1 yum.repos.d]# yum makecache
 Loaded plugins: fastestmirror
 Determining fastest mirrors
 c7-media                                                 | 3.6 kB     00:00     
 (1/4): c7-media/group_gz                                   | 166 kB   00:00     
 (2/4): c7-media/filelists_db                               | 3.2 MB   00:00     
 (3/4): c7-media/primary_db                                 | 3.1 MB   00:00     
 (4/4): c7-media/other_db                                   | 1.3 MB   00:00     
 Metadata Cache Created


