把光盘加载到本地
[root@localhost CentOS]# mount /dev/cdrom /media
在/etc/yum.repos.d/目录下,有两个文件
CentOS-Base.repo和CentOS-Media.repo
其中CentOS-Base.repo记录着网络上的yum源的地址和路径信息等
CentOS-Media.repo记录着可以从本地作为yum源的介质和路径。其中还有这样一个说明:
# CentOS-Media.repo
# # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-5. 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=c5-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ 修改文件
把baseurl中的地址用#号注销掉 用实际地址替代:如 [media-name] #这个名字可以随意改 name=CentOS-$releasever - Media #这条可有可无 baseurl=file:///media/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 编辑完成后保存,执行以下命令,
[root@centos cdrom]# yum --disablerepo=\* --enablerepo=c5-media update
Loading "installonlyn" plugin Setting up Update Process Setting up repositories c5-media 100% |=========================| 1.1 kB 00:00 Reading repository metadata in from local files primary.xml.gz 100% |=========================| 834 kB 00:00 ################################################## 2400/2400 No Packages marked for Update/Obsoletion |
|