赞
踩
这个不敢确定是否好用,自己完全是靠猜想去做的。
1.首先vmware虚拟机先将centos7的iso加载上去。
2.然后创建挂载点:mkdir /mnt/cdrom
3.挂载光驱到挂载点:mount /dev/cdrom /mnt/cdrom/
4.修改yum配置文件
在baseurl加一行:file:///mnt/cdrom
修改enabled=0改为enabled=1
- [root@xserver yum.repos.d]# cat /etc/yum.repos.d/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:///media/CentOS/
- file:///media/cdrom/
- file:///media/cdrecorder/
- file:///mnt/cdrom/
- gpgcheck=1
- # enabled=0
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

5.重新刷新yum缓存:yum makecache
到此就ok了。
不知道这样做对不对,请不要喷我,我是个小白。若这样不是挂载光驱当yum源的正确方法,劳烦大神留言给个正确的方法,谢谢了。
(写这个是因为我想去安装dhcp服务,我yum install dhcp -y结果报错说尝试了好多yum站点都没找到合适的包Error downloading packages: 12:dhcp-4.2.5-68.el7.centos.1.x86_64: [Errno 256] No more mirrors to try.,然后就想着安装光盘上肯定有,所以就试了试,结果操作了一通便好了)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。