Centos7挂载光驱当yum源

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

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.,然后就想着安装光盘上肯定有,所以就试了试,结果操作了一通便好了)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

潇洒哥Kahn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值