1.挂载光盘 [iyunv@localhost ~]# mkdir /media/centos [iyunv@localhost ~]# mount /dev/cdrom /media/centos 2.进入/etc/yum.repos.d目录
[iyunv@localhost ~]# cd /etc/yum.repos.d/ [iyunv@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.BAK # 将CentOS-Base.repo更改为备份文件,这样就可以绕过网络进行本地YUM源安装。 [iyunv@localhost yum.repos.d]# cp CentOS-Media.repo CentOS-Media.repo.BAK # 备份CentOS-Media.repo文件,待会我们要编辑该文件。 3.编辑CentOS-Media.repo 配置文件 [iyunv@localhost yum.repos.d]# vi CentOS-Media.repo # 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/ gpgcheck=0 #检查GPG-KEY,0为不检查,1为检查 enabled=1 #启用YUM源,0为不启用,1为启用 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 ~ 4.配置完成后执行 [iyunv@localhost yum.repos.d]# yum clean all #清除yum源缓存 [iyunv@localhost yum.repos.d]# yum update #更新yum源 更新完成后就可以通过本地YUM源来安装相应服务了。
|