yum 配备本地源
yum 配置本地源
1 先挂载cdrom
#mount /dev/cdrom /mnt
2 编辑 /etc/yum.repos.d/CentOS-Media.repo
# cd /etc/yum.repos.d/
#ls
#mv CentOS-Base.repo CentOS-Base.repo.bak
#vi CentOS-Media.repo
entOS-Base.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-6. 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=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command] [cdrom] #原文是 c6-media 这只是个名字 可以自行修改 name=CentOS-$releasever - Media # 这个也是名字可以自己修改 例如可以改为 myyum 此处没做修改 baseurl=file:///mnt/ #源地址改为挂载的目录 原文中的其他目录可以删掉 gpgcheck=0 #是否校验 改为0 表示关闭,原文是1 并且原文中还有与之相匹配的gpgkey 在此一举关闭校验后可以删掉 enabled=1 #是否开启,改为1 开启
3 清空先前的源缓存
yum clean all