当前位置:   article > 正文

Centos7挂载光驱当yum源_centos 虚拟光驱作为源

centos 虚拟光驱作为源

这个不敢确定是否好用,自己完全是靠猜想去做的。

1.首先vmware虚拟机先将centos7的iso加载上去。

2.然后创建挂载点:mkdir /mnt/cdrom

3.挂载光驱到挂载点:mount /dev/cdrom /mnt/cdrom/

4.修改yum配置文件
在baseurl加一行:file:///mnt/cdrom
修改enabled=0改为enabled=1

  1. [root@xserver yum.repos.d]# cat /etc/yum.repos.d/CentOS-Media.repo
  2. # CentOS-Media.repo
  3. #
  4. # This repo can be used with mounted DVD media, verify the mount point for
  5. # CentOS-7. You can use this repo and yum to install items directly off the
  6. # DVD ISO that we release.
  7. #
  8. # To use this repo, put in your DVD and use it with the other repos too:
  9. # yum --enablerepo=c7-media [command]
  10. #
  11. # or for ONLY the media repo, do this:
  12. #
  13. # yum --disablerepo=\* --enablerepo=c7-media [command]
  14. [c7-media]
  15. name=CentOS-$releasever - Media
  16. baseurl=file:///media/CentOS/
  17. file:///media/cdrom/
  18. file:///media/cdrecorder/
  19. file:///mnt/cdrom/
  20. gpgcheck=1
  21. # enabled=0
  22. enabled=1
  23. 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.,然后就想着安装光盘上肯定有,所以就试了试,结果操作了一通便好了)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/83261
推荐阅读
相关标签
  

闽ICP备14008679号